Skip to content

【BUG】wasmoon doStringSync can not get lua traceback #140

@challen03

Description

@challen03

lua doStringSync can get lua traceback

lua.doStringSync(`
        local a = 1

        local throw_error = function()
            error('test error')
        end


        -- throw_error()

        -- local ret = pcall(throw_error, a)
        local throw_error_wrap = function()
            throw_error()
        end

        print('before throw_error_wrap')
        throw_error_wrap()
        print('after throw_error_wrap')

result:

Error: [string "..."]:5: test error
stack traceback:
        [string "..."]:5: in upvalue 'throw_error'
        [string "..."]:13: in local 'throw_error_wrap'
        [string "..."]:17: in main chunk

but use doString api, can not get lua traceback, only get error line

lua.doString(`
        local a = 1

        local throw_error = function()
            error('test error')
        end


        -- throw_error()

        -- local ret = pcall(throw_error, a)
        local throw_error_wrap = function()
            throw_error()
        end

        print('before throw_error_wrap')
        throw_error_wrap()
        print('after throw_error_wrap')

result:

error Error: [string "..."]:5: test error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions