1 // The MIT License (MIT)
2 
3 // Copyright (c) 2013-2016 Rapptz, ThePhD and contributors
4 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy of
6 // this software and associated documentation files (the "Software"), to deal in
7 // the Software without restriction, including without limitation the rights to
8 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 // the Software, and to permit persons to whom the Software is furnished to do so,
10 // subject to the following conditions:
11 
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 #ifndef SOL_5_X_X_H
23 #define SOL_5_X_X_H
24 
25 #include "version.hpp"
26 
27 #if SOL_LUA_VERSION < 502
28 
29 #define LUA_RIDX_GLOBALS LUA_GLOBALSINDEX
30 
31 #define LUA_OK 0
32 
33 #define lua_pushglobaltable(L) \
34   lua_pushvalue(L, LUA_GLOBALSINDEX)
35 
36 #define luaL_newlib(L, l) \
37   (lua_newtable((L)),luaL_setfuncs((L), (l), 0))
38 
39 void luaL_checkversion(lua_State *L);
40 
41 int lua_absindex(lua_State *L, int i);
42 void lua_copy(lua_State *L, int from, int to);
43 void lua_rawgetp(lua_State *L, int i, const void *p);
44 void lua_rawsetp(lua_State *L, int i, const void *p);
45 void *luaL_testudata(lua_State *L, int i, const char *tname);
46 lua_Number lua_tonumberx(lua_State *L, int i, int *isnum);
47 void lua_getuservalue(lua_State *L, int i);
48 void lua_setuservalue(lua_State *L, int i);
49 void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
50 void luaL_setmetatable(lua_State *L, const char *tname);
51 int luaL_getsubtable(lua_State *L, int i, const char *name);
52 void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level);
53 int luaL_fileresult(lua_State *L, int stat, const char *fname);
54 
55 #endif // Lua 5.1 and below
56 
57 #endif // SOL_5_X_X_H
58