Lua: Fix type confusion between signed and unsigned
[lsnes.git] / include / library / lua-version.hpp
blob589a4ded5fcae047abd73608113ef1b389044de2
1 #ifndef _library__lua_version__hpp__included__
2 #define _library__lua_version__hpp__included__
4 extern "C"
6 #include <lua.h>
10 #if LUA_VERSION_NUM == 501
12 #else
13 #if LUA_VERSION_NUM == 502
15 #define LUA_SUPPORTS_LOAD_MODE
16 #define LUA_SUPPORTS_RIDX_GLOBALS
18 #else
19 #if LUA_VERSION_NUM == 503
21 #define LUA_SUPPORTS_LOAD_MODE
22 #define LUA_SUPPORTS_RIDX_GLOBALS
23 #define LUA_SUPPORTS_INTEGERS
24 #define LUA_SUPPORTS_LOAD_STRING
26 #else
27 #error "Unsupported Lua version"
28 #endif
29 #endif
30 #endif
32 #ifdef LUA_SUPPORTS_INTEGERS
33 #define LUA_INTEGER_POSTFIX(X) X##integer
34 #else
35 #define LUA_INTEGER_POSTFIX(X) X##number
36 #endif
38 #ifdef LUA_SUPPORTS_LOAD_MODE
39 #define LUA_LOADMODE_ARG(X) , X
40 #else
41 #define LUA_LOADMODE_ARG(X)
42 #endif
44 #ifdef LUA_SUPPORTS_RIDX_GLOBALS
45 #define LUA_LOADGLOBALS rawgeti(LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
46 #else
47 #define LUA_LOADGLOBALS pushvalue(LUA_GLOBALSINDEX);
48 #endif
50 #ifdef LUA_SUPPORTS_LOAD_STRING
51 #define LUA_LOAD_CMD "load"
52 #else
53 #define LUA_LOAD_CMD "loadstring"
54 #endif
57 #endif