aboutsummaryrefslogtreecommitdiff
path: root/src/lua.h
diff options
context:
space:
mode:
authoramelia squires <[email protected]>2025-10-15 16:50:46 -0500
committeramelia squires <[email protected]>2025-10-15 16:50:46 -0500
commitb94f6d148193f91cab50d16e2873095827b89b1b (patch)
treef550bd912cdd4c5469cec1ac320cb9c874df3476 /src/lua.h
parent8c2893be56c10af0a696282386b49fdb3c1e4a81 (diff)
better errors and docs
Diffstat (limited to 'src/lua.h')
-rw-r--r--src/lua.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lua.h b/src/lua.h
index 1d5bea1..8fc934c 100644
--- a/src/lua.h
+++ b/src/lua.h
@@ -7,6 +7,7 @@
#ifndef __lua_h
#define __lua_h
+
enum deep_copy_flags {
SKIP_META = (1 << 0),
SKIP_GC = (1 << 1),
@@ -81,12 +82,21 @@ void luaI_jointable(lua_State* L);
lua_settable(L, Tidx);\
lua_pop(L, 1);}
+//in lullaby.h
+extern int _print_errors;
+
#define luaI_error(L, en, str){\
lua_pushnil(L);\
lua_pushstring(L, str);\
+ if(_print_errors) printf("%s\n",str);\
lua_pushinteger(L, en);\
return 3;}
-
+#define luaI_assert(L, eq){_helperluaI_assert(L, eq, __FILE__, __LINE__);}
+#define _helperluaI_assert(L, eq, file, line){\
+ if(!(eq)){\
+ char err[1024] = {0};\
+ sprintf(err, "(%s:%i) %s assertion failed", file, line, #eq);\
+ luaI_error(L, -1, err);}}
int writer(lua_State*, const void*, size_t, void*);