trunk/src/emu/luaengine.c
| r242984 | r242985 | |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | //------------------------------------------------- |
| 459 | | // state_get_value - return value of a devices state |
| 459 | // state_get_value - return value of a device state entry |
| 460 | 460 | // -> manager:machine().devices[":maincpu"].state["PC"].value |
| 461 | 461 | //------------------------------------------------- |
| 462 | 462 | |
| 463 | 463 | UINT64 lua_engine::l_state_get_value(const device_state_entry *d) |
| 464 | 464 | { |
| 465 | | return d->value(); |
| 465 | device_state_interface *state = d->parent_state(); |
| 466 | if(state) { |
| 467 | luaThis->machine().save().dispatch_presave(); |
| 468 | return state->state_int(d->index()); |
| 469 | } else { |
| 470 | return 0; |
| 471 | } |
| 466 | 472 | } |
| 467 | 473 | |
| 468 | 474 | //------------------------------------------------- |
| 469 | | // state_set_value - set value of a devices state |
| 475 | // state_set_value - set value of a device state entry |
| 470 | 476 | // -> manager:machine().devices[":maincpu"].state["D0"].value = 0x0c00 |
| 471 | 477 | //------------------------------------------------- |
| 472 | 478 | |
| 473 | 479 | void lua_engine::l_state_set_value(device_state_entry *d, UINT64 val) |
| 474 | 480 | { |
| 475 | | d->set_value(val); |
| 481 | device_state_interface *state = d->parent_state(); |
| 482 | if(state) { |
| 483 | state->set_state_int(d->index(), val); |
| 484 | luaThis->machine().save().dispatch_presave(); |
| 485 | } |
| 476 | 486 | } |
| 477 | 487 | |
| 478 | 488 | //------------------------------------------------- |