lunarmodules / luassert

Assertion library for Lua
MIT License
206 stars 77 forks source link

assert doesn't return extra arguments #22

Closed daurnimator closed 11 years ago

daurnimator commented 11 years ago

Plain assert does not currently pass it's arguments on.

I found out while trying to use a library that uses assert internally: Eg, the code below exhibits the problem:

function foo()
    if something then
        return nil , "error message"
    else
        return "abc" , "xyz"
    end
end

local x1, x2 = assert ( foo() ) -- With luassert x2 is nil.

Fix requires rewriting the function at https://github.com/Olivine-Labs/luassert/blob/2faa83264eb0439bd2772d80bfd4ce8198986105/src/assert.lua#L155

ajacksified commented 11 years ago

Closing as duplicate (#23)