lua-users home
lua-l archive

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


Do I find a contradiction here with the prototypes in the Lua Reference Manual 5.1? See the insert below.

On 19 jun 2009, at 20:15, Sam Roberts wrote:

On Fri, Jun 19, 2009 at 9:11 AM, Hans van der Meer <H.vanderMeer@uva.nl> wrote:
Thanks for your reply.

I conclude from it that I can safely use "int" for all those variables in C-modules having to do with indices, either on the stack on or in tables.

stack, yes.

table, no. table keys are lua objects, and numeric table indices are lua_Number.

The above remark confuses me. The Lua Reference Manual on page 43 gives:

  lua_rawgeti (lua_State *L, int index, int n);
  Pushes onto the stack the value t[n] ...

  void lua_rawseti (lua_State *L, int index, int n);
  Does the equivalent of t[n] = v, ....

That is "int n", which certainly is not a lua_Number (a "double" according to page 39). Or are these "int n"-s pointing to something else than a "numeric table index" pointing into table t?


Hans van der Meer