Re: Lua_tostring weirdness

  • From: Josh Simmons <simmons.44@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 8 Aug 2012 18:53:14 +1000

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: