diff options
| author | dacctal <donotcontactmevia@email.invalid> | 2026-08-14 07:37:03 +0000 |
|---|---|---|
| committer | dacctal <donotcontactmevia@email.invalid> | 2026-08-14 07:37:03 +0000 |
| commit | 536b651f4086fe01d0bd1f743f54ef650524b122 (patch) | |
| tree | b63a9554ac3ca0d94dc2e9f7da583ad6ca0b358c /include/lua_state.h | |
| parent | 4fa342bcfdb5ebcbe65cabe1fb9ac3a46ea4ddca (diff) | |
i made the install work (kinda)
Diffstat (limited to 'include/lua_state.h')
| -rw-r--r-- | include/lua_state.h | 19 |
1 files changed, 16 insertions, 3 deletions
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; \ } \ |
