You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.
from reading the comment in the code I thought just passing the first state like this might work, but I get an error.
luaState2 = new LuaVM.Lua.State(luaState);
I'm still working on my loading of game prototype from #57 and would like to compare the change made by mod to the main game prototypes.
Basically I load the game lua files. Copy the current game prototypes to a variable. load the mod and then compare the change between the game + mod prototypes with the original one.
Since loading the game file is a good half second and I have to do it for every mod in the game. Possibly hundreds, I was wondering if it was possible to just clone the state after loading the game file and then destroy the clone once I'm done with one mod.
Also what's the best way to destroy a state? Since it would be asyncronous I need to free all the memory that was used.
Thanks!
The text was updated successfully, but these errors were encountered:
Not exactly: the lua C API has no way to clone a lua_State.
However you might be able to clone it via copying the emscripten heap. That may be tricky though: as emscripten has no fork() call as far as I know (see emscripten-core/emscripten#4182): you'd likely have to delve quite deep to figure this out.
from reading the comment in the code I thought just passing the first state like this might work, but I get an error.
// Either wraps existing state; or makes a new one
That function either creates a new lua state, or wraps an existing one to add JS methods. It says nothing about cloning/copying a state.
I'm still working on my loading of game prototype from #57 and would like to compare the change made by mod to the main game prototypes.
Basically I load the game lua files. Copy the current game prototypes to a variable. load the mod and then compare the change between the game + mod prototypes with the original one.
How do you intend to compare states once you clone them?
Also what's the best way to destroy a state?
As in the normal lua C api: lua_close. There is currently no JS wrapper for this function: a patch would be accepted.
However keep in mind that this wouldn't invalidate all references to the state, nor would it automatically destroy the emscripten heap.
Since it would be asyncronous I need to free all the memory that was used.
Hi,
Can you clone a state?
from reading the comment in the code I thought just passing the first state like this might work, but I get an error.
luaState2 = new LuaVM.Lua.State(luaState);
I'm still working on my loading of game prototype from #57 and would like to compare the change made by mod to the main game prototypes.
Basically I load the game lua files. Copy the current game prototypes to a variable. load the mod and then compare the change between the game + mod prototypes with the original one.
Since loading the game file is a good half second and I have to do it for every mod in the game. Possibly hundreds, I was wondering if it was possible to just clone the state after loading the game file and then destroy the clone once I'm done with one mod.
Also what's the best way to destroy a state? Since it would be asyncronous I need to free all the memory that was used.
Thanks!
The text was updated successfully, but these errors were encountered: