mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
jit lib and all
This commit is contained in:
parent
4123830e6c
commit
9872c67b4f
|
@ -38,6 +38,8 @@ enum class lib : char {
|
|||
debug,
|
||||
bit32,
|
||||
io,
|
||||
ffi,
|
||||
jit,
|
||||
count
|
||||
};
|
||||
|
||||
|
@ -108,6 +110,9 @@ public:
|
|||
#if SOL_LUA_VERSION > 501
|
||||
luaL_requiref(L, "bit32", luaopen_bit32, 1);
|
||||
lua_pop(L, 1);
|
||||
#elif defined(SOL_LUAJIT)
|
||||
luaL_requiref(L, "bit32", luaopen_bit, 1);
|
||||
lua_pop(L, 1);
|
||||
#else
|
||||
#endif // Lua 5.2+ only
|
||||
break;
|
||||
|
@ -123,6 +128,16 @@ public:
|
|||
luaL_requiref(L, "debug", luaopen_debug, 1);
|
||||
lua_pop(L, 1);
|
||||
break;
|
||||
case lib::ffi:
|
||||
#ifdef SOL_LUAJIT
|
||||
luaL_requiref(L, "ffi", luaopen_ffi, 1);
|
||||
#endif
|
||||
break;
|
||||
case lib::jit:
|
||||
#ifdef SOL_LUAJIT
|
||||
luaL_requiref(L, "jit", luaopen_jit, 1);
|
||||
#endif
|
||||
break;
|
||||
case lib::count:
|
||||
default:
|
||||
break;
|
||||
|
|
15
tests.cpp
15
tests.cpp
|
@ -358,6 +358,21 @@ TEST_CASE("libraries", "Check if we can open libraries") {
|
|||
REQUIRE_NOTHROW(lua.open_libraries(sol::lib::base, sol::lib::os));
|
||||
}
|
||||
|
||||
TEST_CASE("libraries2", "Check if we can open ALL the libraries") {
|
||||
sol::state lua;
|
||||
REQUIRE_NOTHROW(lua.open_libraries(sol::lib::base,
|
||||
sol::lib::bit32,
|
||||
sol::lib::coroutine,
|
||||
sol::lib::debug,
|
||||
sol::lib::ffi,
|
||||
sol::lib::jit,
|
||||
sol::lib::math,
|
||||
sol::lib::os,
|
||||
sol::lib::package,
|
||||
sol::lib::string,
|
||||
sol::lib::table));
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/usertype", "Show that we can create classes from usertype and use them") {
|
||||
sol::state lua;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user