Jump to content
  • Advertisement
Sign in to follow this  
mjoselli

lua_dobuffer

This topic is 4894 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am using luadobuffer to start status = lua_dobuffer (state,buf,strlen(buf),buf); but how do i close it?? before i used: status = luaL_loadfile(state, filename);//to start the script and lua_close(state);//to closed but when a start with lua_dobuffer when i trie to close with lua_close i get an error... can someone help me?? thanks

Share this post


Link to post
Share on other sites
Advertisement
You create a state with lua_open(), not luaL_loadfile() or lua_dobuffer. Those functions merely operate on the already-opened state. For more information, see the manual.

Share this post


Link to post
Share on other sites
ok
but when i tried to close it does not work,when im using luadobuffer
its there a way to closed when i use luadobuffer???
i tried to look in the manual but i didnt find anything about it

Share this post


Link to post
Share on other sites
There is just not nearly enough information in your post for us to answer that question.

One possible reason you might be getting an error when you close a state is if you are trying to delete allocated memory twice. This can happen if things get confused as to who 'owns' a particular variable or piece of data. Lua maintains it's own internal variables and memory which are deleted when they are garbage collected or when the state is destroyed. If you pass a pointer to a variable or object that was created in your engine code to Lua, and tell Lua to take ownership of the variable, then when the state is closed that variable will be deleted. If you delete that variable yourself, in engine code, before closing the Lua state, then it will be deleted again when the state is closed, causing an exception.

So check very careful to make sure you know exactly who owns a given variable if it is passed into Lua state, and ensure that variables are not being deleted twice.

Good luck

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!