diff options
Diffstat (limited to 'src/state.c')
-rw-r--r-- | src/state.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/state.c b/src/state.c index c6c04d7..a2de5cb 100644 --- a/src/state.c +++ b/src/state.c | |||
@@ -129,31 +129,31 @@ static int require_lanes_core( lua_State* L) | |||
129 | static const luaL_Reg libs[] = | 129 | static const luaL_Reg libs[] = |
130 | { | 130 | { |
131 | { LUA_LOADLIBNAME, luaopen_package}, | 131 | { LUA_LOADLIBNAME, luaopen_package}, |
132 | { LUA_TABLIBNAME, luaopen_table}, | 132 | { LUA_TABLIBNAME, luaopen_table}, |
133 | { LUA_STRLIBNAME, luaopen_string}, | 133 | { LUA_STRLIBNAME, luaopen_string}, |
134 | { LUA_MATHLIBNAME, luaopen_math}, | 134 | { LUA_MATHLIBNAME, luaopen_math}, |
135 | #ifndef PLATFORM_XBOX // no os/io libs on xbox | 135 | #ifndef PLATFORM_XBOX // no os/io libs on xbox |
136 | { LUA_OSLIBNAME, luaopen_os}, | 136 | { LUA_OSLIBNAME, luaopen_os}, |
137 | { LUA_IOLIBNAME, luaopen_io}, | 137 | { LUA_IOLIBNAME, luaopen_io}, |
138 | #endif // PLATFORM_XBOX | 138 | #endif // PLATFORM_XBOX |
139 | #if LUA_VERSION_NUM >= 503 | 139 | #if LUA_VERSION_NUM >= 503 |
140 | { LUA_UTF8LIBNAME, luaopen_utf8}, | 140 | { LUA_UTF8LIBNAME, luaopen_utf8}, |
141 | #endif | 141 | #endif |
142 | #if LUA_VERSION_NUM >= 502 | 142 | #if LUA_VERSION_NUM >= 502 |
143 | #ifdef luaopen_bit32 | 143 | #ifdef luaopen_bit32 |
144 | { LUA_BITLIBNAME, luaopen_bit32}, | 144 | { LUA_BITLIBNAME, luaopen_bit32}, |
145 | #endif | 145 | #endif |
146 | { LUA_COLIBNAME, luaopen_coroutine}, // Lua 5.2: coroutine is no longer a part of base! | 146 | { LUA_COLIBNAME, luaopen_coroutine}, // Lua 5.2: coroutine is no longer a part of base! |
147 | #else // LUA_VERSION_NUM | 147 | #else // LUA_VERSION_NUM |
148 | { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package | 148 | { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package |
149 | #endif // LUA_VERSION_NUM | 149 | #endif // LUA_VERSION_NUM |
150 | { LUA_DBLIBNAME, luaopen_debug}, | 150 | { LUA_DBLIBNAME, luaopen_debug}, |
151 | #if defined LUA_JITLIBNAME // building against LuaJIT headers, add some LuaJIT-specific libs | 151 | #if LUAJIT_FLAVOR != 0 // building against LuaJIT headers, add some LuaJIT-specific libs |
152 | //#pragma message( "supporting JIT base libs") | 152 | //#pragma message( "supporting JIT base libs") |
153 | { LUA_BITLIBNAME, luaopen_bit}, | 153 | { LUA_BITLIBNAME, luaopen_bit}, |
154 | { LUA_JITLIBNAME, luaopen_jit}, | 154 | { LUA_JITLIBNAME, luaopen_jit}, |
155 | { LUA_FFILIBNAME, luaopen_ffi}, | 155 | { LUA_FFILIBNAME, luaopen_ffi}, |
156 | #endif // LUA_JITLIBNAME | 156 | #endif // LUAJIT_FLAVOR |
157 | 157 | ||
158 | { LUA_DBLIBNAME, luaopen_debug}, | 158 | { LUA_DBLIBNAME, luaopen_debug}, |
159 | { "lanes.core", require_lanes_core}, // So that we can open it like any base library (possible since we have access to the init function) | 159 | { "lanes.core", require_lanes_core}, // So that we can open it like any base library (possible since we have access to the init function) |
@@ -249,6 +249,10 @@ void initialize_on_state_create( Universe* U, lua_State* L) | |||
249 | lua_State* create_state( Universe* U, lua_State* from_) | 249 | lua_State* create_state( Universe* U, lua_State* from_) |
250 | { | 250 | { |
251 | lua_State* L; | 251 | lua_State* L; |
252 | #if LUAJIT_FLAVOR == 64 | ||
253 | // for some reason, LuaJIT 64 bits does not support creating a state with lua_newstate... | ||
254 | L = luaL_newstate(); | ||
255 | #else // LUAJIT_FLAVOR == 64 | ||
252 | if( U->provide_allocator != NULL) // we have a function we can call to obtain an allocator | 256 | if( U->provide_allocator != NULL) // we have a function we can call to obtain an allocator |
253 | { | 257 | { |
254 | lua_pushcclosure( from_, U->provide_allocator, 0); | 258 | lua_pushcclosure( from_, U->provide_allocator, 0); |
@@ -264,6 +268,7 @@ lua_State* create_state( Universe* U, lua_State* from_) | |||
264 | // reuse the allocator provided when the master state was created | 268 | // reuse the allocator provided when the master state was created |
265 | L = lua_newstate( U->protected_allocator.definition.allocF, U->protected_allocator.definition.allocUD); | 269 | L = lua_newstate( U->protected_allocator.definition.allocF, U->protected_allocator.definition.allocUD); |
266 | } | 270 | } |
271 | #endif // LUAJIT_FLAVOR == 64 | ||
267 | 272 | ||
268 | if( L == NULL) | 273 | if( L == NULL) |
269 | { | 274 | { |