Closed hansdpf closed 3 years ago
Does set a timeout when initializing wasmoon solves your problem?
const lua = await factory.createEngine()
lua.global.setTimeout(Date.now() + 1000)
// ... run lua
I guess a timeout function would solve the problem - it tried it: an infinite loop is stopped after n ms, but the string.find example is not stopped. Also I think it clashes with my lua internal debug.sethook settings, but that would be solvable.
But thanks for the hint.
I have a test case with an infinite loop that I cannot break:
local a = string.find(("a"):rep(1e4), ".-.-.-.-b$" )
With debug.sethook I can include an instruction counter, but it doesn't work here. Any suggestions how I can avoid this?
Thanks