ceifa / wasmoon

A real lua 5.4 VM with JS bindings made with webassembly
MIT License
449 stars 29 forks source link

Can not get lua error in coroutine #70

Closed coconutxin closed 1 year ago

coconutxin commented 1 year ago
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.

coconutxin commented 1 year ago

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