The Witchcraft Compiler Collection
WCC
 All Data Structures Files Functions Variables Typedefs Macros
mylaux.h
Go to the documentation of this file.
1 
2 /*
3 ** ===============================================================
4 ** some useful macros
5 ** ===============================================================
6 */
7 
8 
9 #define luaL_newlibtable(L,l) \
10  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
11 
12 #define luaL_newlib(L,l) \
13  (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
14 
15 #define luaL_argcheck(L, cond,arg,extramsg) \
16  ((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
17 #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
18 #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
19 
20 #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
21 
22 #define luaL_dofile(L, fn) \
23  (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
24 
25 #define luaL_dostring(L, s) \
26  (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
27 
28 #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
29 
30 #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
31 
32 #define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
33 
34