A bit of research on mouse clicks

This commit is contained in:
2026-04-14 17:16:46 -04:00
parent 7296847fb5
commit 2f83910897
5 changed files with 31 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -394,7 +394,14 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
// Get the actor and place, C++ version. Make sure both exist. // Get the actor and place, C++ version. Make sure both exist.
Tangible *tactor = tangible_get(actor_id); Tangible *tactor = tangible_get(actor_id);
Tangible *tplace = tangible_get(place_id); Tangible *tplace = tangible_get(place_id);
if ((tactor == nullptr) || (tplace == nullptr)) { if (tactor == nullptr) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("no such actor tangible");
return;
}
if (tplace == nullptr) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("no such place tangible");
return; return;
} }
@@ -408,6 +415,8 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
classname = datasb.read_string_limit(100); classname = datasb.read_string_limit(100);
funcname = datasb.read_string_limit(100); funcname = datasb.read_string_limit(100);
} catch (const StreamException &ex) { } catch (const StreamException &ex) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("datapack passed to probe_lua_call was corrupted");
return; return;
} }
@@ -419,6 +428,8 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
LS.rawget(actor, tangibles, actor_id); LS.rawget(actor, tangibles, actor_id);
LS.rawget(place, tangibles, place_id); LS.rawget(place, tangibles, place_id);
if (!LS.istable(actor) || !LS.istable(place)) { if (!LS.istable(actor) || !LS.istable(place)) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("probe_lua_call failed to properly look up actor or place");
return; return;
} }
@@ -433,11 +444,19 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
// Get the true classname. This also checks validity of the class. // Get the true classname. This also checks validity of the class.
classname = LS.classname(lclass); classname = LS.classname(lclass);
if (classname.empty()) return; if (classname.empty()) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("classname is not a valid class");
return;
}
// Get the function from the class. // Get the function from the class.
LS.rawget(lfunc, lclass, funcname); LS.rawget(lfunc, lclass, funcname);
if (!LS.isfunction(lfunc)) return; if (!LS.isfunction(lfunc)) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("function does not exist");
return;
}
// Call the closure. // Call the closure.
int calltop = lua_gettop(L); int calltop = lua_gettop(L);
@@ -449,6 +468,8 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
nargs++; nargs++;
} }
} catch (const StreamException &exc) { } catch (const StreamException &exc) {
retvals->write_lua_value_type(LuaValueType::STRING);
retvals->write_string("could not pass parameters to lua (bug)");
return; return;
} }

View File

@@ -5,4 +5,5 @@
ut-table.lua ut-table.lua
hotkeys.lua hotkeys.lua
menu.lua
login.lua login.lua