Debian Codegraph @

podofo/tools/podofoimpose/lua_compat.h

raw
1 #ifndef LUA_COMPAT_H_IMPOSE
2 #define LUA_COMPAT_H_IMPOSE
3
4 extern "C" {
5 #include "lua.h"
6 // Note: If you're missing these, you're using lua 5.0 and haven't installed
7 // the extension libraries.
8 #include "lualib.h"
9 #include "lauxlib.h"
10 }
11
12 #if !defined(LUA_VERSION_NUM)
13 // Old lua without numeric version
14 #define LUA_VERSION_NUM 0
15 #endif
16
17 // Handle an API difference in the lua_open call between
18 // Lua 5.1 and Lua 5.2.
19 #if LUA_VERSION_NUM >= 502
20 inline lua_State* imp_lua_open(void) {
21 return luaL_newstate();
22 }
23 #else
24 inline lua_State* imp_lua_open(void) {
25 return lua_open();
26 }
27 #endif
28
29 // Handle an API difference in the dofile and getn calls between
30 // Lua 5.0 and Lua 5.1.
31 #if LUA_VERSION_NUM >= 501
32 inline int imp_lua_dofile(lua_State* L, const char * path) {
33 return luaL_dofile(L, path);
34 }
35 #else
36 inline int imp_lua_dofile(lua_State* L, const char * path) {
37 return lua_dofile(L, path);
38 }
39 #endif
40
41 #endif // LUA_COMPAT_H_IMPOSE