trunk/src/emu/luaengine.cpp
r255125 | r255126 | |
1390 | 1390 | machine().add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(lua_engine::on_machine_frame), this)); |
1391 | 1391 | } |
1392 | 1392 | |
| 1393 | int lua_engine::lua_machine::l_popmessage(lua_State *L) |
| 1394 | { |
| 1395 | running_machine *m = luabridge::Stack<running_machine *>::get(L, 1); |
| 1396 | luaL_argcheck(L, lua_isstring(L, 2), 2, "message (string) expected"); |
| 1397 | m->popmessage("%s", luaL_checkstring(L, 2)); |
| 1398 | return 0; |
| 1399 | } |
| 1400 | |
| 1401 | int lua_engine::lua_machine::l_logerror(lua_State *L) |
| 1402 | { |
| 1403 | running_machine *m = luabridge::Stack<running_machine *>::get(L, 1); |
| 1404 | luaL_argcheck(L, lua_isstring(L, 2), 2, "message (string) expected"); |
| 1405 | m->logerror("[luaengine] %s\n", luaL_checkstring(L, 2)); |
| 1406 | return 0; |
| 1407 | } |
| 1408 | |
1393 | 1409 | //------------------------------------------------- |
1394 | 1410 | // initialize - initialize lua hookup to emu engine |
1395 | 1411 | //------------------------------------------------- |
r255125 | r255126 | |
1421 | 1437 | .addFunction ("machine", &machine_manager::machine) |
1422 | 1438 | .addFunction ("options", &machine_manager::options) |
1423 | 1439 | .endClass () |
1424 | | .beginClass <running_machine> ("machine") |
| 1440 | .beginClass <lua_machine> ("lua_machine") |
| 1441 | .addCFunction ("popmessage", &lua_machine::l_popmessage) |
| 1442 | .addCFunction ("logerror", &lua_machine::l_logerror) |
| 1443 | .endClass () |
| 1444 | .deriveClass <running_machine, lua_machine> ("machine") |
1425 | 1445 | .addFunction ("exit", &running_machine::schedule_exit) |
1426 | 1446 | .addFunction ("hard_reset", &running_machine::schedule_hard_reset) |
1427 | 1447 | .addFunction ("soft_reset", &running_machine::schedule_soft_reset) |