aboutsummaryrefslogtreecommitdiff
path: root/src/state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.cpp')
-rw-r--r--src/state.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/state.cpp b/src/state.cpp
index 68569bd..ebe4097 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -119,47 +119,47 @@ void serialize_require(lua_State* L_)
119} 119}
120 120
121// ################################################################################################# 121// #################################################################################################
122 122namespace {
123namespace global 123 namespace local {
124{ 124 static luaL_Reg const sLibs[] = {
125 static luaL_Reg const sLibs[] = { 125 { "base", nullptr }, // ignore "base" (already acquired it)
126 { "base", nullptr }, // ignore "base" (already acquired it)
127#if LUA_VERSION_NUM >= 502 126#if LUA_VERSION_NUM >= 502
128#ifdef luaopen_bit32 127#ifdef luaopen_bit32
129 { LUA_BITLIBNAME, luaopen_bit32 }, 128 { LUA_BITLIBNAME, luaopen_bit32 },
130#endif 129#endif
131 { LUA_COLIBNAME, luaopen_coroutine }, // Lua 5.2: coroutine is no longer a part of base! 130 { LUA_COLIBNAME, luaopen_coroutine }, // Lua 5.2: coroutine is no longer a part of base!
132#else // LUA_VERSION_NUM 131#else // LUA_VERSION_NUM
133 { LUA_COLIBNAME, nullptr }, // Lua 5.1: part of base package 132 { LUA_COLIBNAME, nullptr }, // Lua 5.1: part of base package
134#endif // LUA_VERSION_NUM 133#endif // LUA_VERSION_NUM
135 { LUA_DBLIBNAME, luaopen_debug }, 134 { LUA_DBLIBNAME, luaopen_debug },
136#ifndef PLATFORM_XBOX // no os/io libs on xbox 135#ifndef PLATFORM_XBOX // no os/io libs on xbox
137 { LUA_IOLIBNAME, luaopen_io }, 136 { LUA_IOLIBNAME, luaopen_io },
138 { LUA_OSLIBNAME, luaopen_os }, 137 { LUA_OSLIBNAME, luaopen_os },
139#endif // PLATFORM_XBOX 138#endif // PLATFORM_XBOX
140 { LUA_LOADLIBNAME, luaopen_package }, 139 { LUA_LOADLIBNAME, luaopen_package },
141 { LUA_MATHLIBNAME, luaopen_math }, 140 { LUA_MATHLIBNAME, luaopen_math },
142 { LUA_STRLIBNAME, luaopen_string }, 141 { LUA_STRLIBNAME, luaopen_string },
143 { LUA_TABLIBNAME, luaopen_table }, 142 { LUA_TABLIBNAME, luaopen_table },
144#if LUA_VERSION_NUM >= 503 143#if LUA_VERSION_NUM >= 503
145 { LUA_UTF8LIBNAME, luaopen_utf8 }, 144 { LUA_UTF8LIBNAME, luaopen_utf8 },
146#endif 145#endif
147#if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, add some LuaJIT-specific libs 146#if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, add some LuaJIT-specific libs
148 { LUA_BITLIBNAME, luaopen_bit }, 147 { LUA_BITLIBNAME, luaopen_bit },
149 { LUA_FFILIBNAME, luaopen_ffi }, 148 { LUA_FFILIBNAME, luaopen_ffi },
150 { LUA_JITLIBNAME, luaopen_jit }, 149 { LUA_JITLIBNAME, luaopen_jit },
151#endif // LUAJIT_FLAVOR() 150#endif // LUAJIT_FLAVOR()
152 151
153 { kLanesCoreLibName, require_lanes_core } // So that we can open it like any base library (possible since we have access to the init function) 152 { kLanesCoreLibName, require_lanes_core } // So that we can open it like any base library (possible since we have access to the init function)
154 }; 153 };
155 154
156} // namespace global 155 } // namespace local
156} // namespace
157 157
158// ################################################################################################# 158// #################################################################################################
159 159
160static void open1lib(lua_State* L_, std::string_view const& name_) 160static void open1lib(lua_State* L_, std::string_view const& name_)
161{ 161{
162 for (luaL_Reg const& _entry : global::sLibs) { 162 for (luaL_Reg const& _entry : local::sLibs) {
163 if (name_ == _entry.name) { 163 if (name_ == _entry.name) {
164 lua_CFunction const _libfunc{ _entry.func }; 164 lua_CFunction const _libfunc{ _entry.func };
165 if (!_libfunc) { 165 if (!_libfunc) {