Lots of work on lua call interface, also improved makefiles

This commit is contained in:
2025-02-24 16:46:05 -05:00
parent 4023d19247
commit bed4f3e805
10 changed files with 1870 additions and 101 deletions

View File

@@ -19,7 +19,11 @@ void push_simple_dynamic(lua_State *L, StreamBuffer *sb) {
break;
}
case SimpleDynamicTag::TOKEN: {
LuaToken token(sb->read_string_view());
std::string_view toktext = sb->read_string_view();
LuaToken token(toktext);
if (token.empty() && !toktext.empty()) {
throw StreamCorruption();
}
lua_pushlightuserdata(L, token.voidvalue());
break;
}
@@ -860,6 +864,7 @@ void World::invoke_lua_expr(int64_t actor_id, int64_t place_id, std::string_view
assert(stack_is_clear());
}
volatile int vx;
void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view datapack) {
assert(stack_is_clear());
@@ -879,8 +884,12 @@ void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view
if ((!sv::is_lua_id(classname)) || (!sv::is_lua_id(funcname))) {
return;
}
// TODO: Add support for the wildcard classname.
// TODO: Add check for permit_invoke(classname, funcname)
if (funcname == "printhi") {
vx = 0;
}
{
lua_State *L = state();
LuaVar lclass, lfunc;