diff options
-rw-r--r-- | src/state.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c index 9075c02..c6c04d7 100644 --- a/src/state.c +++ b/src/state.c | |||
@@ -249,7 +249,7 @@ 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( U->provide_allocator != NULL) | 252 | if( U->provide_allocator != NULL) // we have a function we can call to obtain an allocator |
253 | { | 253 | { |
254 | lua_pushcclosure( from_, U->provide_allocator, 0); | 254 | lua_pushcclosure( from_, U->provide_allocator, 0); |
255 | lua_call( from_, 0, 1); | 255 | lua_call( from_, 0, 1); |
@@ -261,7 +261,8 @@ lua_State* create_state( Universe* U, lua_State* from_) | |||
261 | } | 261 | } |
262 | else | 262 | else |
263 | { | 263 | { |
264 | L = luaL_newstate(); | 264 | // reuse the allocator provided when the master state was created |
265 | L = lua_newstate( U->protected_allocator.definition.allocF, U->protected_allocator.definition.allocUD); | ||
265 | } | 266 | } |
266 | 267 | ||
267 | if( L == NULL) | 268 | if( L == NULL) |