Invoke can now only invoke method in class 'invoke', likewise for 'probe'

This commit is contained in:
2026-06-03 17:03:07 -04:00
parent 6658fb7940
commit e9c562eee5
12 changed files with 121 additions and 142 deletions

View File

@@ -461,6 +461,11 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
return;
}
if (classname != "probe") {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("currently, can only probe functions in class 'probe'");
}
LuaVar lclass, lfunc, actor, place, mt, tangibles, retvec, retval;
LuaExtStack LS(L, lclass, lfunc, actor, place, mt, tangibles, retvec, retval);
@@ -944,6 +949,9 @@ void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view
} catch (const StreamException &ex) {
return;
}
// Currently, we only allow calling functions in class 'invoke'.
if (classname != "invoke") return;
{
lua_State *L = state();
@@ -966,8 +974,6 @@ void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view
classname = LS.classname(lclass);
if (classname.empty()) return;
// TODO: CHECK FOR PERMIT_INVOKE.
// Get the function from the class.
LS.rawget(lfunc, lclass, funcname);
if (!LS.isfunction(lfunc)) return;