Re: Beta10: some issues on Efika/ARM

  • From: Mike Pall <mike-1205@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 10 May 2012 17:03:45 +0200

Ignacio Burgueño wrote:
> On a similar note, that same code on Win x64 gives an error message may be
> a bit misleading.
> 
> LuaJIT 2.0.0-beta10 -- Copyright (C) 2005-2012 Mike Pall. http://luajit.org/
> JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc fuse
> 
> stdin:1: attempt to call global 'tostring' (a string value)
> stack traceback:
>         stdin:1: in main chunk
>         [C]: ?

Well, yes. That's a consequence of tostring() tail-calling the
__tostring metamethod (i.e. the string value). The variable name
derived by the error handler points to tostring as the culprit. In
general, you may get strange errors when tail calls come into play.

> On Lua 5.1.4, the error message is:
> 
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> attempt to call a string value
> stack traceback:
>         [C]: in function 'tostring'
>         stdin:1: in main chunk
>         [C]: ?

That's because plain Lua doesn't tail-call the metamethod. Which in
turn means you can't yield from it.

But LuaJIT promises to be able to yield from all metamethods, so
that's not something I can easily throw out.

--Mike

Other related posts: