12 #define MAX_TRACE_DEPTH 20
18 #define LUAUTILS_KV_HEADER_ONLY
19 #include "luautils_kv.inc"
24 typedef uint32_t cpureg_t;
26 typedef uint64_t cpureg_t;
30 bool luautils_getfunction(lua_State *L,
const char *module,
31 char const *
function,
bool propagate);
34 int luautils_getfuncref(lua_State *L,
const char *module,
35 char const *
function);
40 int lua_guarded_pcall(lua_State *L,
int nargs,
int nresults,
int errfunc);
43 bool luautils_cpcall(lua_State *L, lua_CFunction func,
const char *fname,
int nargs);
46 #define LUA_CPCALL(L, func, nargs) luautils_cpcall(L, func, #func, nargs)
49 bool luautils_dostring (lua_State *L,
const char *str);
55 int32_t luautils_toint32(lua_State *L,
int idx);
56 #define luautils_touint32(L, idx) (uint32_t)luautils_toint32(L, idx)
58 uint32_t luautils_asuint32(lua_State *L,
int idx);
62 void luautils_stackclean(lua_State *L,
int basepointer);
64 void luautils_pushptr(lua_State *L,
const void *ptr);
65 void luautils_pushwstring(lua_State *L,
const wchar_t *s,
int len);
70 #define luautils_pushptrnum(L, value) lua_pushnumber(L, (uintptr_t)(value))
72 void *lua_getBuffer(lua_State *L,
int idx,
size_t *len);
75 void *luautils_checkptr(lua_State *L,
int idx);
76 bool luautils_isptr(lua_State *L,
int idx,
void* *value);
77 void *luautils_toptr(lua_State *L,
int idx);
78 cpureg_t luautils_tocpu(lua_State *L,
int idx);
81 void luautils_ptrtonumber(lua_State *L,
int idx,
int offset,
bool nil_is_zero);
83 void luautils_ptrtostring(lua_State *L,
int idx,
int format);
91 bool luautils_equal(lua_State *L,
int index1,
int index2);
93 bool luautils_isEmpty(lua_State *L,
int idx);
96 int luautils_dofile(lua_State *L,
const char *filename,
bool stacktrace);
99 int luautils_table_keys(lua_State *L,
int table,
int filter);
100 bool luautils_table_keyof(lua_State *L,
int table);
101 size_t luautils_table_count(lua_State *L,
int idx,
int *maxn);
102 bool luautils_table_issequential(lua_State *L,
int idx);
103 void luautils_table_append(lua_State *L,
int idx,
int pos,
int pop);
104 void luautils_table_merge(lua_State *L,
int from,
int to,
int dest);
107 int luautils_xpack(lua_State *L,
int from,
int to);
108 int luautils_xunpack(lua_State *L,
int table,
int from,
int to);
111 const char *luautils_pushfstring(lua_State *L,
const char *fmt, ...);
114 void libopen(lua_State *L, lua_CFunction func,
const char *fname,
115 int expect_args,
int pop_args);
118 bool luautils_require(lua_State *L,
const char *module_name);
120 void luautils_cmodule(lua_State *L,
const char *module_name);
126 bool luaListVars(lua_State *L,
int level);
129 char *lua_callerPosition(lua_State *L,
int level);
130 bool luautils_pushinfo(lua_State *L,
const char *what, lua_Debug *ar);
132 #define luaL_addliteral(B, s) luaL_addlstring(B, "" s, sizeof(s)-1)
133 void luaL_addfmt(luaL_Buffer *B,
const char *fmt, ...);
134 void luautils_checktype(lua_State *L,
int index,
int type,
const char *where);
#define LUA_CFUNC(fname)
a macro for proper Lua CFunction declarations
Definition: luahelpers.h:15
Lua helpers declared as macros.
boolean data type and constants/macros