• Advertisement

Archived

This topic is now archived and is closed to further replies.

Lua script reload

This topic is 5299 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

Hey, I have a problem with reloading a script. Mine is running in a thread. When i now reload the file, he simply continues at its old position. So : How i can i solve this problem ? Is there any kind of pointer, that i can set to the beginning of the file ? Or how do i successfully kill the thread ? THX in advance

Share this post


Link to post
Share on other sites
Advertisement
Ok, i experimented a bit around.
As it seems, the file is now successfully being reloaded.
But there is one other problem :
I have my script and anywhere in it comes a loadmap("xyz"); call.
This is a c function, that now loads another map with its own script.
The problem is that the calling script executes some more function.
I tried, to stop the script in the loadmap-c-function via lua_yield as soon as possible, but it doesnt work successfully, it still executes code.
Any ideas ?
THX

Share this post


Link to post
Share on other sites
lua_yield only works on coroutines; functions that a started via lua_createcoroutine (not the exact name, but that''s it).

Other, UGLY possibility:

Create a script error (call a nil variable entry)
<- NOT RECOMMMENDED

Share this post


Link to post
Share on other sites
Hm... After "extensive research" i think there is just one solution that fits my needs and that is placing a coroutine.yield() just after my loadmap command...

Share this post


Link to post
Share on other sites

  • Advertisement