Ok, so I add this to my device_luaprinter_interface:
It's a pointer to lua_engine in m_luaengine,
and also a pointer to a member function of lua_engine.
So I can call the function by
((*m_luaengine).*lualoadstring)(astr);
where astr is the string to execute.
static void (lua_engine::* lualoadstring)(const char * astr);
static lua_engine *m_luaengine;
void callloadstring(const char *astr) {
printf("Trying callloadstring %s\n",astr);
((*m_luaengine).*lualoadstring)(astr);
}
and then in luaengine initialize them:
device_luaprinter_interface::lualoadstring = &lua_engine::load_string;
device_luaprinter_interface::m_luaengine = this;
so now I can do this:
[MAME]> l = manager:machine().lp[1]
[MAME]> l:callloadstring(" l:callloadstring('print(\"whoa!\")') ")
Trying callloadstring l:callloadstring('print("whoa!")')
Trying callloadstring print("whoa!")
whoa!