diff options
author | moteus <mimir@newmail.ru> | 2013-12-26 12:00:41 +0400 |
---|---|---|
committer | moteus <mimir@newmail.ru> | 2013-12-26 12:00:41 +0400 |
commit | febf9da1af8ba4cf0f8cc64b6af2adb0dcf9b354 (patch) | |
tree | 735ef634f8ebeab2101aa21897fd4e4e2f826f32 /src/l52util.h | |
parent | 46ed59584e5407c49a02f1ea6bede6487259a92e (diff) | |
download | lua-llthreads2-febf9da1af8ba4cf0f8cc64b6af2adb0dcf9b354.tar.gz lua-llthreads2-febf9da1af8ba4cf0f8cc64b6af2adb0dcf9b354.tar.bz2 lua-llthreads2-febf9da1af8ba4cf0f8cc64b6af2adb0dcf9b354.zip |
First commit.
Diffstat (limited to 'src/l52util.h')
-rw-r--r-- | src/l52util.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/l52util.h b/src/l52util.h new file mode 100644 index 0000000..f4f0497 --- /dev/null +++ b/src/l52util.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _LZUTILS_H_9B43D914_9652_4E22_9A43_8073502BF3F4_ | ||
2 | #define _LZUTILS_H_9B43D914_9652_4E22_9A43_8073502BF3F4_ | ||
3 | |||
4 | #include "lua.h" | ||
5 | #include "lauxlib.h" | ||
6 | |||
7 | #if LUA_VERSION_NUM >= 502 // lua 5.2 | ||
8 | |||
9 | // lua_rawgetp | ||
10 | // lua_rawsetp | ||
11 | // luaL_setfuncs | ||
12 | // lua_absindex | ||
13 | |||
14 | |||
15 | #define lua_objlen lua_rawlen | ||
16 | |||
17 | int luaL_typerror (lua_State *L, int narg, const char *tname); | ||
18 | |||
19 | void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l); | ||
20 | |||
21 | #else // lua 5.1 | ||
22 | |||
23 | // functions form lua 5.2 | ||
24 | |||
25 | # define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1))) | ||
26 | # define lua_rawlen lua_objlen | ||
27 | |||
28 | void lua_rawgetp (lua_State *L, int index, const void *p); | ||
29 | void lua_rawsetp (lua_State *L, int index, const void *p); | ||
30 | void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); | ||
31 | |||
32 | #endif | ||
33 | |||
34 | int lutil_newmetatablep (lua_State *L, const void *p); | ||
35 | void lutil_getmetatablep (lua_State *L, const void *p); | ||
36 | void lutil_setmetatablep (lua_State *L, const void *p); | ||
37 | |||
38 | #define lutil_newudatap(L, TTYPE, TNAME) (TTYPE *)lutil_newudatap_impl(L, sizeof(TTYPE), TNAME) | ||
39 | int lutil_isudatap (lua_State *L, int ud, const void *p); | ||
40 | void *lutil_checkudatap (lua_State *L, int ud, const void *p); | ||
41 | int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods, int nup); | ||
42 | |||
43 | void *lutil_newudatap_impl (lua_State *L, size_t size, const void *p); | ||
44 | |||
45 | #endif | ||
46 | |||