From 536b651f4086fe01d0bd1f743f54ef650524b122 Mon Sep 17 00:00:00 2001 From: dacctal Date: Fri, 14 Aug 2026 07:37:03 +0000 Subject: i made the install work (kinda) --- include/lua_state.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include/lua_state.h') diff --git a/include/lua_state.h b/include/lua_state.h index db689fe..6c36f37 100644 --- a/include/lua_state.h +++ b/include/lua_state.h @@ -18,18 +18,31 @@ void free_lua_config(void); do { \ lua_getfield(L, -1, name); \ if (!lua_is##type(L, -1)) { \ - log_error("lua: expected type '" #type "' for %s in %.*s", \ + log_error("lua: expected type '" #type "' for '%s' in '%.*s'", \ name, str_fmt(file)); \ lua_pop(L, pop_num); \ return false; \ } \ } while (0) +#define lua_get_table(name, file, pop_num) \ + do { \ + lua_pushstring(L, name); \ + lua_gettable(L, -2); \ + lua_pop(L, 1); \ + if (!lua_istable(L, -1)) { \ + log_error("lua: expected type 'table' for '%s' in '%.*s'", \ + name, str_fmt(file)); \ + /*lua_pop(L, pop_num);*/ \ + return false; \ + } \ + } while (0) + #define lua_run_function(name, file, params, returns, pop_num) \ do { \ - if (lua_pcall(L, params, returns, 0) { \ + if (lua_pcall(L, params, returns, 0)) { \ log_error("lua: '%s' function borked in %.*s: %s", \ - name, str_fmt(file)), lua_tostring(L, -1); \ + name, str_fmt(file), lua_tostring(L, -1)); \ lua_pop(L, pop_num); \ return false; \ } \ -- cgit v1.2.3