ceifa / wasmoon

A real lua 5.4 VM with JS bindings made with webassembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not get lua error in coroutine

coconutxin opened this issue · comments

const lua = await factory.createEngine()
lua.doStringSync(`
    local co = coroutine.create(function()
        local a
        a = a + 1
        print(a)
    end)
    coroutine.resume(co)
`)

await lua.doString(`
    local co = coroutine.create(function()
        local a
        a = a + 1
        print(a)
    end)
    coroutine.resume(co)
`)

The above code can not throw error.
Both lua_resume and lua_pcall are not returning error.
It is very strange.

Oh, I can get the error message by coroutine.resume.
print(coroutine.resume(co))