lua_newthread的意义是新建一个调用栈,这个调用栈与某个lua vm对象共享全局环境,它本身和线程没有关系,默认的情况下,它不能解决并发问题。 解决方案如下: s = lua_newthread(source); lua_setglobal(source, "___safe_thread_vm_"); -- 将调用栈记录到全局变量 lua_gc(source, LUA_GCCOLLECT); -- 垃...
问lua_newthread() & LUA_REGISTRYINDEX独立性EN这是一个很简单的问题,但这是gotchas.So。上一篇文章...
感觉好像 xLua 没有封装 lua_newthread 以及其对应的功能,我们的用例里面这个用的比较多,老的 LuaInterface 也有LuaThread来对应这个 (刚刚特地看了下 nLua 好像也把这个去掉了)。 请问有考虑过实现这方面的功能吗?谢谢! Collaborator Collaborator chexiongshengcommentedFeb 8, 2017 ...
Josh, are you using lua_newthread(L) in the editor or engine when calling the Lua script? I ran into an issue where coroutines are failing in Lua possibly because you are using lua_newthread(L) instead of lua_newcthread(). I guess in LuaJIT if you use lua_newcthread() it will...
[2] Lua环境的安装(LuaDist)... 5311播放 05:01 [3] print方法、单行和多行注释 5059播放 07:42 [4] Lua中的标识符命名规则 4545播放 07:37 [5] 全局变量 3071播放 03:32 [6] Lua编程和C 编程的一个区别 4327播放 02:17 [7] Lua中的数据类型 3090播放 10:15 [8] 关于nil的用法 26...