lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 10.05.2013 19:47 schröbte Egor Skriptunoff:
(_G and tonumber or assert)('', '')

bad argument #2 to 'assert' (number expected, got string)

Am 10.05.2013 23:34 schröbte Coda Highland:
On Fri, May 10, 2013 at 2:31 PM, Mark Gabby <mwgabby@gmail.com> wrote:
Oh wait, spoke too soon. "or" is actually lower priority. Sorry. The chart
in the reference manual goes from lower to higher. So I don't know.

Well, DOES _G['tonumber'] exist? If it would evaluate falsy, then that
WOULD return assert.


`assert` would be fine with a string (or *any* value for that matter) as the second argument since the first argument is true-ish. So it really is `tonumber` throwing the error ...

The problem seems to be that the debug code figuring out a name for the called function gets confused by `(_G and tonumber or assert)`.

Error occurs in both 5.1.5 and 5.2.2.

Philipp