lua_call有办法强制结束吗?
lua吧
全部回复
仅看楼主
level 1
SeaSeeStr 楼主
比如lua_call的脚本中有while 1 do ... end 这样的语句,有什么办法能强制停止lua_call的运行?
2018年09月14日 08点09分 1
level 1
SeaSeeStr 楼主
2018年09月14日 09点09分 2
level 9
用 break
break 会强制性停止正在执行中的 while 循环。
2018年09月14日 14点09分 3
我是想在宿主c中强制终止lua虚拟机
2018年09月15日 05点09分
@SeaSeeStr lua_close?
2018年09月17日 14点09分
level 1
SeaSeeStr 楼主
已解决,设置一个lua脚本运行每行hook函数,lua脚本运行每行时,会执行这个hook,在hook中判断一个bool的状态,当为true时,yield就可以了:
lua_sethook(m_L, LuaYeildHook, LUA_MASKLINE, 0);
void LuaYeildHook(lua_State *_L, lua_Debug *ar){
if(m_bYeild){
lua_yield(_L, 0);
}
}
2018年10月18日 16点10分 4
将这个bool置为true,lua主程序就让出(退出)了
2018年10月18日 16点10分
1