mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add app.is_instance_alive & rename app.terminate to app.terminate_instance
This commit is contained in:
parent
466f515ea9
commit
6bbc78098d
3 changed files with 19 additions and 3 deletions
|
|
@ -425,7 +425,16 @@ static int l_start_background_instance(lua::State* L) {
|
|||
return lua::pushinteger(L, handle);
|
||||
}
|
||||
|
||||
static int l_terminate(lua::State* L) {
|
||||
static int l_is_instance_alive(lua::State* L) {
|
||||
int handle = lua::tointeger(L, 1);
|
||||
if (handle < 0 || handle >= ::processes.size()) {
|
||||
throw std::runtime_error("invalid process handle");
|
||||
}
|
||||
auto& process = ::processes[handle];
|
||||
return lua::pushboolean(L, process && process->isActive());
|
||||
}
|
||||
|
||||
static int l_terminate_instance(lua::State* L) {
|
||||
int handle = lua::tointeger(L, 1);
|
||||
if (handle < 0 || handle >= ::processes.size()) {
|
||||
throw std::runtime_error("invalid process handle");
|
||||
|
|
@ -472,6 +481,7 @@ const luaL_Reg applib[] = {
|
|||
{"create_memory_device", lua::wrap<l_create_memory_device>},
|
||||
{"start_debug_instance", lua::wrap<l_start_debug_instance>},
|
||||
{"start_background_instance", lua::wrap<l_start_background_instance>},
|
||||
{"terminate", lua::wrap<l_terminate>},
|
||||
{"is_instance_alive", lua::wrap<l_is_instance_alive>},
|
||||
{"terminate_instance", lua::wrap<l_terminate_instance>},
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue