mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
luaengine: add popmessage and logerror for lua (nw)
This commit is contained in:
parent
67339c5dfd
commit
0825bf2a2f
@ -1390,6 +1390,22 @@ void lua_engine::attach_notifiers()
|
||||
machine().add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(lua_engine::on_machine_frame), this));
|
||||
}
|
||||
|
||||
int lua_engine::lua_machine::l_popmessage(lua_State *L)
|
||||
{
|
||||
running_machine *m = luabridge::Stack<running_machine *>::get(L, 1);
|
||||
luaL_argcheck(L, lua_isstring(L, 2), 2, "message (string) expected");
|
||||
m->popmessage("%s", luaL_checkstring(L, 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lua_engine::lua_machine::l_logerror(lua_State *L)
|
||||
{
|
||||
running_machine *m = luabridge::Stack<running_machine *>::get(L, 1);
|
||||
luaL_argcheck(L, lua_isstring(L, 2), 2, "message (string) expected");
|
||||
m->logerror("[luaengine] %s\n", luaL_checkstring(L, 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// initialize - initialize lua hookup to emu engine
|
||||
//-------------------------------------------------
|
||||
@ -1421,7 +1437,11 @@ void lua_engine::initialize()
|
||||
.addFunction ("machine", &machine_manager::machine)
|
||||
.addFunction ("options", &machine_manager::options)
|
||||
.endClass ()
|
||||
.beginClass <running_machine> ("machine")
|
||||
.beginClass <lua_machine> ("lua_machine")
|
||||
.addCFunction ("popmessage", &lua_machine::l_popmessage)
|
||||
.addCFunction ("logerror", &lua_machine::l_logerror)
|
||||
.endClass ()
|
||||
.deriveClass <running_machine, lua_machine> ("machine")
|
||||
.addFunction ("exit", &running_machine::schedule_exit)
|
||||
.addFunction ("hard_reset", &running_machine::schedule_hard_reset)
|
||||
.addFunction ("soft_reset", &running_machine::schedule_soft_reset)
|
||||
|
@ -130,6 +130,10 @@ private:
|
||||
static UINT64 l_state_get_value(const device_state_entry *d);
|
||||
static void l_state_set_value(device_state_entry *d, UINT64 v);
|
||||
static luabridge::LuaRef l_dev_get_memspaces(const device_t *d);
|
||||
struct lua_machine {
|
||||
int l_popmessage(lua_State *L);
|
||||
int l_logerror(lua_State *L);
|
||||
};
|
||||
struct lua_addr_space {
|
||||
template<typename T> int l_mem_read(lua_State *L);
|
||||
template<typename T> int l_mem_write(lua_State *L);
|
||||
|
Loading…
Reference in New Issue
Block a user