Re: Lua_tostring weirdness

  • From: rob <rob.mail@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 08 Aug 2012 12:48:39 +0200

Hi,

Thank you! Getting the number of arguments first seems to be great.

Though it seems a bit odd to allow top to bottom indexing with a non-empty stack only, while the bottom to top method works in both cases... It's a bit inconsistent, but it's probably just me.

Rob
On 08/08/2012 10:53, Josh Simmons wrote:
On Wed, Aug 8, 2012 at 6:48 PM, rob <rob.mail@xxxxxxxxxxx> wrote:
Hi,

Is this meant to work with a -1 stack index (i.e. from top to bottom)?
Because whenever I use lua_isstring or lua_isnoneornil with -1 it seems to
be broken. If I attempt to check the stack using 1, it works fine.


Like Mike mentioned earlier, this is not an acceptable index
http://www.lua.org/manual/5.1/manual.html#3.2

You should check the stack height with lua_gettop to check the number
of arguments passed to a function.

Cheers,
Josh.





Other related posts: