mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Let's hope we didn't break shit...
This commit is contained in:
parent
5363a63de0
commit
5468ab8b4e
@ -20,8 +20,8 @@
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2017-06-17 04:51:25.897832 UTC
|
||||
// This header was generated with sol v2.17.5 (revision b811e73)
|
||||
// Generated 2017-06-20 03:04:07.874965 UTC
|
||||
// This header was generated with sol v2.17.5 (revision 5363a63)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
@ -1015,6 +1015,9 @@ namespace sol {
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
#include <lauxlib.h>
|
||||
#ifdef SOL_USING_CXX_LUAJIT
|
||||
#include <luajit.h>
|
||||
#endif // C++ LuaJIT ... whatever that means
|
||||
#else
|
||||
#include <lua.hpp>
|
||||
#endif // C++ Mangling for Lua
|
||||
@ -1261,28 +1264,26 @@ inline int luaL_loadbufferx(lua_State* L, const char* buff, size_t size, const c
|
||||
#define lua_pushglobaltable(L) \
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX)
|
||||
|
||||
#ifndef SOL_LUAJIT
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#else
|
||||
#if SOL_LUAJIT_VERSION < 20100
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#endif // LuaJIT-2.1.0-beta3 added this in itself
|
||||
#endif // LuaJIT Compatibility
|
||||
|
||||
void luaL_checkversion(lua_State *L);
|
||||
|
||||
int lua_absindex(lua_State *L, int i);
|
||||
#if !defined(SOL_LUAJIT_VERSION) || SOL_LUAJIT_VERSION < 20100
|
||||
void lua_copy(lua_State *L, int from, int to);
|
||||
lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum);
|
||||
lua_Number lua_tonumberx(lua_State *L, int i, int *isnum);
|
||||
const lua_Number *lua_version(lua_State *L);
|
||||
void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
|
||||
void luaL_setmetatable(lua_State *L, const char *tname);
|
||||
void *luaL_testudata(lua_State *L, int i, const char *tname);
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#endif // LuaJIT-2.1.0-beta3 added these compatibility functions
|
||||
|
||||
int lua_absindex(lua_State *L, int i);
|
||||
void lua_rawgetp(lua_State *L, int i, const void *p);
|
||||
void lua_rawsetp(lua_State *L, int i, const void *p);
|
||||
void *luaL_testudata(lua_State *L, int i, const char *tname);
|
||||
lua_Number lua_tonumberx(lua_State *L, int i, int *isnum);
|
||||
void lua_getuservalue(lua_State *L, int i);
|
||||
void lua_setuservalue(lua_State *L, int i);
|
||||
void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
|
||||
void luaL_setmetatable(lua_State *L, const char *tname);
|
||||
int luaL_getsubtable(lua_State *L, int i, const char *name);
|
||||
void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level);
|
||||
int luaL_fileresult(lua_State *L, int stat, const char *fname);
|
||||
@ -1309,6 +1310,7 @@ inline int lua_absindex(lua_State *L, int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
#if !defined(SOL_LUAJIT_VERSION) || SOL_LUAJIT_VERSION < 20100
|
||||
inline void lua_copy(lua_State *L, int from, int to) {
|
||||
int abs_to = lua_absindex(L, to);
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
@ -1316,18 +1318,50 @@ inline void lua_copy(lua_State *L, int from, int to) {
|
||||
lua_replace(L, abs_to);
|
||||
}
|
||||
|
||||
inline void lua_rawgetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_rawget(L, abs_i);
|
||||
inline lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum) {
|
||||
lua_Integer n = lua_tointeger(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline void lua_rawsetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
inline lua_Number lua_tonumberx(lua_State *L, int i, int *isnum) {
|
||||
lua_Number n = lua_tonumber(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline const lua_Number *lua_version(lua_State *L) {
|
||||
static const lua_Number version = LUA_VERSION_NUM;
|
||||
if (L == NULL) return &version;
|
||||
// TODO: wonky hacks to get at the inside of the incomplete type lua_State?
|
||||
//else return L->l_G->version;
|
||||
else return &version;
|
||||
}
|
||||
|
||||
/*
|
||||
** Adapted from Lua 5.2.0
|
||||
*/
|
||||
inline void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
|
||||
luaL_checkstack(L, nup + 1, "too many upvalues");
|
||||
for (; l->name != NULL; l++) { /* fill the table with given functions */
|
||||
int i;
|
||||
lua_pushstring(L, l->name);
|
||||
for (i = 0; i < nup; i++) /* copy upvalues to the top */
|
||||
lua_pushvalue(L, -(nup + 1));
|
||||
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
|
||||
lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
|
||||
}
|
||||
lua_pop(L, nup); /* remove upvalues */
|
||||
}
|
||||
|
||||
inline void luaL_setmetatable(lua_State *L, const char *tname) {
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_insert(L, -2);
|
||||
lua_rawset(L, abs_i);
|
||||
luaL_getmetatable(L, tname);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
inline void *luaL_testudata(lua_State *L, int i, const char *tname) {
|
||||
@ -1345,13 +1379,20 @@ inline void *luaL_testudata(lua_State *L, int i, const char *tname) {
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline lua_Number lua_tonumberx(lua_State *L, int i, int *isnum) {
|
||||
lua_Number n = lua_tonumber(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
inline void lua_rawgetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_rawget(L, abs_i);
|
||||
}
|
||||
return n;
|
||||
|
||||
inline void lua_rawsetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_insert(L, -2);
|
||||
lua_rawset(L, abs_i);
|
||||
}
|
||||
|
||||
inline static void push_package_table(lua_State *L) {
|
||||
@ -1403,28 +1444,6 @@ inline void lua_setuservalue(lua_State *L, int i) {
|
||||
lua_setfenv(L, i);
|
||||
}
|
||||
|
||||
/*
|
||||
** Adapted from Lua 5.2.0
|
||||
*/
|
||||
inline void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
|
||||
luaL_checkstack(L, nup + 1, "too many upvalues");
|
||||
for (; l->name != NULL; l++) { /* fill the table with given functions */
|
||||
int i;
|
||||
lua_pushstring(L, l->name);
|
||||
for (i = 0; i < nup; i++) /* copy upvalues to the top */
|
||||
lua_pushvalue(L, -(nup + 1));
|
||||
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
|
||||
lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
|
||||
}
|
||||
lua_pop(L, nup); /* remove upvalues */
|
||||
}
|
||||
|
||||
inline void luaL_setmetatable(lua_State *L, const char *tname) {
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
luaL_getmetatable(L, tname);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
inline int luaL_getsubtable(lua_State *L, int i, const char *name) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
luaL_checkstack(L, 3, "not enough stack slots");
|
||||
@ -1540,14 +1559,6 @@ inline void luaL_traceback(lua_State *L, lua_State *L1,
|
||||
}
|
||||
#endif
|
||||
|
||||
inline const lua_Number *lua_version(lua_State *L) {
|
||||
static const lua_Number version = LUA_VERSION_NUM;
|
||||
if (L == NULL) return &version;
|
||||
// TODO: wonky hacks to get at the inside of the incomplete type lua_State?
|
||||
//else return L->l_G->version;
|
||||
else return &version;
|
||||
}
|
||||
|
||||
inline static void luaL_checkversion_(lua_State *L, lua_Number ver) {
|
||||
const lua_Number* v = lua_version(L);
|
||||
if (v != lua_version(NULL))
|
||||
@ -1820,14 +1831,6 @@ inline lua_Unsigned luaL_optunsigned(lua_State *L, int i, lua_Unsigned def) {
|
||||
return luaL_opt(L, luaL_checkunsigned, i, def);
|
||||
}
|
||||
|
||||
inline lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum) {
|
||||
lua_Integer n = lua_tointeger(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline void lua_len(lua_State *L, int i) {
|
||||
switch (lua_type(L, i)) {
|
||||
case LUA_TSTRING: /* fall through */
|
||||
|
@ -33,28 +33,26 @@
|
||||
#define lua_pushglobaltable(L) \
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX)
|
||||
|
||||
#ifndef SOL_LUAJIT
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#else
|
||||
#if SOL_LUAJIT_VERSION < 20100
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#endif // LuaJIT-2.1.0-beta3 added this in itself
|
||||
#endif // LuaJIT Compatibility
|
||||
|
||||
void luaL_checkversion(lua_State *L);
|
||||
|
||||
int lua_absindex(lua_State *L, int i);
|
||||
#if !defined(SOL_LUAJIT_VERSION) || SOL_LUAJIT_VERSION < 20100
|
||||
void lua_copy(lua_State *L, int from, int to);
|
||||
lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum);
|
||||
lua_Number lua_tonumberx(lua_State *L, int i, int *isnum);
|
||||
const lua_Number *lua_version(lua_State *L);
|
||||
void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
|
||||
void luaL_setmetatable(lua_State *L, const char *tname);
|
||||
void *luaL_testudata(lua_State *L, int i, const char *tname);
|
||||
#define luaL_newlib(L, l) \
|
||||
(lua_newtable((L)),luaL_setfuncs((L), (l), 0))
|
||||
#endif // LuaJIT-2.1.0-beta3 added these compatibility functions
|
||||
|
||||
int lua_absindex(lua_State *L, int i);
|
||||
void lua_rawgetp(lua_State *L, int i, const void *p);
|
||||
void lua_rawsetp(lua_State *L, int i, const void *p);
|
||||
void *luaL_testudata(lua_State *L, int i, const char *tname);
|
||||
lua_Number lua_tonumberx(lua_State *L, int i, int *isnum);
|
||||
void lua_getuservalue(lua_State *L, int i);
|
||||
void lua_setuservalue(lua_State *L, int i);
|
||||
void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
|
||||
void luaL_setmetatable(lua_State *L, const char *tname);
|
||||
int luaL_getsubtable(lua_State *L, int i, const char *name);
|
||||
void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level);
|
||||
int luaL_fileresult(lua_State *L, int stat, const char *fname);
|
||||
|
@ -41,6 +41,7 @@ inline int lua_absindex(lua_State *L, int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
#if !defined(SOL_LUAJIT_VERSION) || SOL_LUAJIT_VERSION < 20100
|
||||
inline void lua_copy(lua_State *L, int from, int to) {
|
||||
int abs_to = lua_absindex(L, to);
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
@ -48,18 +49,50 @@ inline void lua_copy(lua_State *L, int from, int to) {
|
||||
lua_replace(L, abs_to);
|
||||
}
|
||||
|
||||
inline void lua_rawgetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_rawget(L, abs_i);
|
||||
inline lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum) {
|
||||
lua_Integer n = lua_tointeger(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline void lua_rawsetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
inline lua_Number lua_tonumberx(lua_State *L, int i, int *isnum) {
|
||||
lua_Number n = lua_tonumber(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline const lua_Number *lua_version(lua_State *L) {
|
||||
static const lua_Number version = LUA_VERSION_NUM;
|
||||
if (L == NULL) return &version;
|
||||
// TODO: wonky hacks to get at the inside of the incomplete type lua_State?
|
||||
//else return L->l_G->version;
|
||||
else return &version;
|
||||
}
|
||||
|
||||
/*
|
||||
** Adapted from Lua 5.2.0
|
||||
*/
|
||||
inline void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
|
||||
luaL_checkstack(L, nup + 1, "too many upvalues");
|
||||
for (; l->name != NULL; l++) { /* fill the table with given functions */
|
||||
int i;
|
||||
lua_pushstring(L, l->name);
|
||||
for (i = 0; i < nup; i++) /* copy upvalues to the top */
|
||||
lua_pushvalue(L, -(nup + 1));
|
||||
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
|
||||
lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
|
||||
}
|
||||
lua_pop(L, nup); /* remove upvalues */
|
||||
}
|
||||
|
||||
inline void luaL_setmetatable(lua_State *L, const char *tname) {
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_insert(L, -2);
|
||||
lua_rawset(L, abs_i);
|
||||
luaL_getmetatable(L, tname);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
inline void *luaL_testudata(lua_State *L, int i, const char *tname) {
|
||||
@ -77,13 +110,20 @@ inline void *luaL_testudata(lua_State *L, int i, const char *tname) {
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline lua_Number lua_tonumberx(lua_State *L, int i, int *isnum) {
|
||||
lua_Number n = lua_tonumber(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
inline void lua_rawgetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_rawget(L, abs_i);
|
||||
}
|
||||
return n;
|
||||
|
||||
inline void lua_rawsetp(lua_State *L, int i, const void *p) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
lua_pushlightuserdata(L, (void*)p);
|
||||
lua_insert(L, -2);
|
||||
lua_rawset(L, abs_i);
|
||||
}
|
||||
|
||||
inline static void push_package_table(lua_State *L) {
|
||||
@ -135,28 +175,6 @@ inline void lua_setuservalue(lua_State *L, int i) {
|
||||
lua_setfenv(L, i);
|
||||
}
|
||||
|
||||
/*
|
||||
** Adapted from Lua 5.2.0
|
||||
*/
|
||||
inline void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
|
||||
luaL_checkstack(L, nup + 1, "too many upvalues");
|
||||
for (; l->name != NULL; l++) { /* fill the table with given functions */
|
||||
int i;
|
||||
lua_pushstring(L, l->name);
|
||||
for (i = 0; i < nup; i++) /* copy upvalues to the top */
|
||||
lua_pushvalue(L, -(nup + 1));
|
||||
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
|
||||
lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
|
||||
}
|
||||
lua_pop(L, nup); /* remove upvalues */
|
||||
}
|
||||
|
||||
inline void luaL_setmetatable(lua_State *L, const char *tname) {
|
||||
luaL_checkstack(L, 1, "not enough stack slots");
|
||||
luaL_getmetatable(L, tname);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
inline int luaL_getsubtable(lua_State *L, int i, const char *name) {
|
||||
int abs_i = lua_absindex(L, i);
|
||||
luaL_checkstack(L, 3, "not enough stack slots");
|
||||
@ -272,14 +290,6 @@ inline void luaL_traceback(lua_State *L, lua_State *L1,
|
||||
}
|
||||
#endif
|
||||
|
||||
inline const lua_Number *lua_version(lua_State *L) {
|
||||
static const lua_Number version = LUA_VERSION_NUM;
|
||||
if (L == NULL) return &version;
|
||||
// TODO: wonky hacks to get at the inside of the incomplete type lua_State?
|
||||
//else return L->l_G->version;
|
||||
else return &version;
|
||||
}
|
||||
|
||||
inline static void luaL_checkversion_(lua_State *L, lua_Number ver) {
|
||||
const lua_Number* v = lua_version(L);
|
||||
if (v != lua_version(NULL))
|
||||
@ -559,14 +569,6 @@ inline lua_Unsigned luaL_optunsigned(lua_State *L, int i, lua_Unsigned def) {
|
||||
return luaL_opt(L, luaL_checkunsigned, i, def);
|
||||
}
|
||||
|
||||
inline lua_Integer lua_tointegerx(lua_State *L, int i, int *isnum) {
|
||||
lua_Integer n = lua_tointeger(L, i);
|
||||
if (isnum != NULL) {
|
||||
*isnum = (n != 0 || lua_isnumber(L, i));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
inline void lua_len(lua_State *L, int i) {
|
||||
switch (lua_type(L, i)) {
|
||||
case LUA_TSTRING: /* fall through */
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
#include <lauxlib.h>
|
||||
#ifdef SOL_USING_CXX_LUAJIT
|
||||
#include <luajit.h>
|
||||
#endif // C++ LuaJIT ... whatever that means
|
||||
#else
|
||||
#include <lua.hpp>
|
||||
#endif // C++ Mangling for Lua
|
||||
|
Loading…
x
Reference in New Issue
Block a user