diff options
author | 2021-05-03 05:40:31 +1000 | |
---|---|---|
committer | 2021-05-03 05:40:31 +1000 | |
commit | 7bc5b9c9945fbb8af042a63cd66dbbf7f761dbd9 (patch) | |
tree | 494062a8457de983855293a37e4efb3d3b7bb15b /src/frontend/mame/luaengine.cpp | |
parent | 23b87373b67d491676edc654deeddbcd1b3b8b58 (diff) |
layouts: Use self-closing tags for bounds and color elements.
Diffstat (limited to 'src/frontend/mame/luaengine.cpp')
-rw-r--r-- | src/frontend/mame/luaengine.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index ea0ad8fc3b9..2e93d725ed3 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -932,7 +932,7 @@ void lua_engine::initialize() auto thread_type = emu.new_usertype<context>("thread", sol::call_constructor, sol::constructors<sol::types<>>()); thread_type.set("start", [](context &ctx, const char *scr) { std::string script(scr); - if(ctx.busy) + if (ctx.busy) return false; std::thread th([&ctx, script]() { sol::state thstate; @@ -954,19 +954,22 @@ void lua_engine::initialize() thstate["status"] = ctx.result; }; auto ret = func(); - if (ret.valid()) { + if (ret.valid()) + { const char *tmp = ret.get<const char *>(); if (tmp != nullptr) ctx.result = tmp; else osd_printf_error("[LUA ERROR] in thread: return value must be string\n"); } - else { + else + { sol::error err = ret; osd_printf_error("[LUA ERROR] in thread: %s\n", err.what()); } } - else { + else + { sol::error err = res; osd_printf_error("[LUA ERROR] when loading script for thread: %s\n", err.what()); } @@ -978,13 +981,13 @@ void lua_engine::initialize() return true; }); thread_type.set("continue", [](context &ctx, const char *val) { - if(!ctx.yield) + if (!ctx.yield) return; ctx.result = val; ctx.sync.notify_all(); }); thread_type.set("result", sol::property([](context &ctx) -> std::string { - if(ctx.busy && !ctx.yield) + if (ctx.busy && !ctx.yield) return ""; return ctx.result; })); |