diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2022-02-07 16:34:47 +0100 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2022-02-07 16:34:47 +0100 |
| commit | 46730eb47d0d736998a0ebcad4d8f1318fefd096 (patch) | |
| tree | f57957d9f9f5de6f9f9d4326cb8a1d05e106f913 /src | |
| parent | c913a6747c420ff12fc1f0c39df791215ad2fcfd (diff) | |
| download | lanes-46730eb47d0d736998a0ebcad4d8f1318fefd096.tar.gz lanes-46730eb47d0d736998a0ebcad4d8f1318fefd096.tar.bz2 lanes-46730eb47d0d736998a0ebcad4d8f1318fefd096.zip | |
A Lane's Lua state uses the Universe-defined allocator by default
Diffstat (limited to 'src')
| -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) |
