Add VALIDATE_LUA as a function in lpxserver and lpxclient

This commit is contained in:
2025-12-03 19:55:53 -05:00
parent 27b5ce7ef4
commit a242244f9c
9 changed files with 86 additions and 27 deletions

View File

@@ -377,14 +377,10 @@ eng::string World::probe_lua_expr(int64_t actor_id, std::string_view lua) {
LuaVar closure;
LuaExtStack LS(L, closure);
// create the compiled closure.
int status = luaL_loadbuffer(L, lua.data(), lua.size(), "=probe");
lua_replace(L, closure.index());
if (status != LUA_OK) {
// The closure is actually an error message. Do nothing.
// This should normally not happen: LuaConsole should filter
// out syntax errors.
eng::string errmsg = LS.load(closure, lua, "probe");
if (!errmsg.empty()) {
// This should normally not happen: the front end should
// filter expressions for syntactic lua validity.
return "";
}