Update lua-engine.cpp

Added functionality for unloading a ROM. utilizing a function present in "window.cpp", a new Lua function was added to the emu API to allow Lua scripts to close out of games without having to close out of the whole emulator.
This commit is contained in:
Artur Bekker 2022-11-26 14:54:11 -05:00 committed by GitHub
parent d153d5182d
commit 334294a06e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -645,6 +645,13 @@ static int emu_insertOrEjectDisk(lua_State* L)
return 0;
}
// emu.closeRom()
// Closes out of currently running ROM to allow user to switch games
static int emu_closeRom(lua_State* L)
{
CloseGame();
return 0;
}
// emu.loadrom(string filename)
//
@ -6089,6 +6096,7 @@ static const struct luaL_reg emulib [] = {
{"getdir", emu_getdir},
{"switchDisk", emu_switchDisk},
{"insertOrEjectDisk", emu_insertOrEjectDisk},
{"closeRom", emu_closeRom},
{"loadrom", emu_loadrom},
{"print", print}, // sure, why not
{"exit", emu_exit}, // useful for run-and-close scripts