-
Notifications
You must be signed in to change notification settings - Fork 361
/
ElunaCompat.h
43 lines (38 loc) · 1.28 KB
/
ElunaCompat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef ELUNACOMPAT_H
#define ELUNACOMPAT_H
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
};
/* Compatibility layer for compiling with Lua 5.1 or LuaJIT */
#if LUA_VERSION_NUM == 501
int luaL_getsubtable(lua_State* L, int i, const char* name);
const char* luaL_tolstring(lua_State* L, int idx, size_t* len);
int lua_absindex(lua_State* L, int i);
#define lua_pushglobaltable(L) \
lua_pushvalue((L), LUA_GLOBALSINDEX)
#define lua_rawlen(L, idx) \
lua_objlen(L, idx)
#define lua_pushunsigned(L, u) \
lua_pushinteger(L, u)
#define lua_load(L, buf_read, dec_buf, str, NULL) \
lua_load(L, buf_read, dec_buf, str)
#if !defined LUAJIT_VERSION
void* luaL_testudata(lua_State* L, int index, const char* tname);
void luaL_setmetatable(lua_State* L, const char* tname);
#define luaL_setfuncs(L, l, n) luaL_register(L, NULL, l)
#endif
#endif
#if LUA_VERSION_NUM > 502
#define lua_dump(L, writer, data) \
lua_dump(L, writer, data, 0)
#define lua_pushunsigned(L, u) \
lua_pushinteger(L, u)
#endif
#endif