how to unload the script from memory to properly write the implementation of reloading scripts For a long time wanted to write a plugin that allows you to run lua scripts for vc. In this plugin lies Plugin-SDK DK http://bit.ly/2IJB9wN the sdk has its main thread, which is an infinite loop, in a way. If there put delay, for example, 10 seconds, then at this time will stop the game itself. Therefore, we launch a new independent stream with a flag, so that it is only one. Searching all lua files in a folder, run in a new thread with a new lua state. Threads and lua States are added to vectors. There is a check for errors, run the script, the counter of running scripts increases, get the stack function main, run it. As follows. lua_pcall(L, 0, 0, 0);// run the file. lua_getglobal(L, "main"); if (LUA_TFUNCTION == lua_type(L, -1)){ luastate.push_back(L); counts++; lua_pcall(L, 0, 0, 0); Lua contains the main function, which has an infinite loop. Everything works, but there is one but. How do I reboot all scripts? Press ctrl, go through the cycle for vector c lua States, remove from the stack all, but lua state is not unloaded from memory, so it has an infinite loop. Please tell me how to unload the script from memory to properly write the implementation of reloading scripts?. plugin.cpp main.lua https://ift.tt/eA8V8J
For a long time wanted to write a plugin that allows you to run lua scripts for vc. In this plugin lies Plugin-SDK DK http://bit.ly/2IJB9wN the sdk has its main thread, which is an infinite loop, in a way. If there put delay, for example, 10 seconds, then at this time will stop the game itself. Therefore, we launch a new independent stream with a flag, so that it is only one. Searching all lua files in a folder, run in a new thread with a new lua state. Threads and lua States are added to vectors. There is a check for errors, run the script, the counter of running scripts increases, get the stack function main, run it. As follows. lua_pcall(L, 0, 0, 0);// run the file. lua_getglobal(L, "main"); if (LUA_TFUNCTION == lua_type(L, -1)){ luastate.push_back(L); counts++; lua_pcall(L, 0, 0, 0); Lua contains the main function, which has an infinite loop. Everything works, but there is one but. How do I reboot all scripts? Press ctrl, go through the cycle for vector c lua States, remove from the stack all, but lua state is not unloaded from memory, so it has an infinite loop. Please tell me how to unload the script from memory to properly write the implementation of reloading scripts?. plugin.cpp main.lua
from GameDev.net http://bit.ly/31AMnwo
from GameDev.net http://bit.ly/31AMnwo
ليست هناك تعليقات