trunk/src/emu/luaengine.c
| r30911 | r30912 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "emuopts.h" |
| 14 | 14 | #include "osdepend.h" |
| 15 | #include "drivenum.h" |
| 15 | 16 | #include "lua/lua.hpp" |
| 16 | 17 | #include "lua/lib/lualibs.h" |
| 17 | 18 | #include "web/mongoose.h" |
| r30911 | r30912 | |
| 131 | 132 | return 1; |
| 132 | 133 | } |
| 133 | 134 | |
| 135 | int emu_exit(lua_State *L) |
| 136 | { |
| 137 | machine_manager::instance()->machine()->schedule_exit(); |
| 138 | return 1; |
| 139 | } |
| 140 | |
| 141 | int emu_start(lua_State *L) |
| 142 | { |
| 143 | const char *system_name = luaL_checkstring(L,1); |
| 144 | |
| 145 | int index = driver_list::find(system_name); |
| 146 | if (index != -1) { |
| 147 | machine_manager::instance()->schedule_new_driver(driver_list::driver(index)); |
| 148 | machine_manager::instance()->machine()->schedule_hard_reset(); |
| 149 | } |
| 150 | return 1; |
| 151 | } |
| 152 | |
| 134 | 153 | static const struct luaL_Reg emu_funcs [] = |
| 135 | 154 | { |
| 136 | 155 | { "gamename", emu_gamename }, |
| 137 | 156 | { "keypost", emu_keypost }, |
| 157 | { "exit", emu_exit }, |
| 158 | { "start", emu_start }, |
| 138 | 159 | { NULL, NULL } /* sentinel */ |
| 139 | 160 | }; |
| 140 | 161 | |