aboutsummaryrefslogtreecommitdiff
path: root/src/lua.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua.h')
-rw-r--r--src/lua.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/lua.h b/src/lua.h
index db58862..cfff148 100644
--- a/src/lua.h
+++ b/src/lua.h
@@ -7,11 +7,14 @@
#ifndef __lua_h
#define __lua_h
+
enum deep_copy_flags {
SKIP_META = (1 << 0),
SKIP_GC = (1 << 1),
IS_META = (1 << 2),
SKIP__G = (1 << 3),
+ SKIP_LOCALS = (1 << 4),
+ STRIP_GC = (1 << 5),
};
#endif
@@ -38,8 +41,8 @@ typedef int (*stream_free_function)(void**);
void luaI_newstream(lua_State* L, stream_read_function, stream_free_function, void*);
int luaI_nothing(lua_State*);
-void luaI_jointable(lua_State* L, int main, int merge);
-
+int env_table(lua_State* L, int provide_table);
+void luaI_jointable(lua_State* L);
//generic macro that takes other macros (see below)
#define _tset_b(L, Tidx, K, V, F)\
@@ -65,6 +68,10 @@ void luaI_jointable(lua_State* L, int main, int merge);
_tset_b(L, Tidx, K, V, lua_pushcfunction)
#define luaI_tsetlud(L, Tidx, K, V)\
_tset_b(L, Tidx, K, V, lua_pushlightuserdata)
+#define luaI_tsetnil(L, Tidx, K)\
+ lua_pushstring(L, K);\
+ lua_pushnil(L);\
+ lua_settable(L, Tidx);
#define luaI_treplk(L, Tidx, K, nK){\
lua_pushstring(L, K);\
@@ -76,12 +83,21 @@ void luaI_jointable(lua_State* L, int main, int merge);
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*);
@@ -98,6 +114,8 @@ int writer(lua_State*, const void*, size_t, void*);
#define lua_gc(A, B) lua_gc(A, B, 0)
#elif LUA_VERSION_NUM == 501
+ #define LUA_OK 0
+
#define luaL_tolstring lua_tolstring
#define lua_dump(A, B, C, D) lua_dump(A, B, C)