lua-users home
lua-l archive

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


Hello Everyone
I am new to Lua programming. I have gone through the notes on lua and searched on google. But I cant understand few of these functions.Please excuse me for being slow:

1. is LuaL_TNUMBER same as Lua_TONUMEBER?if not what is LUA_TNUMBER?

2.I have to import a C function(with two arguments) to lua. I have seen in many examples, whenever C functions with arguments are called they do this

luaL_checktype(L, 1, LUA_TNUMBER);

my question is why do we do this to check the arguments?

3. why do we do a lua_pushinteger??
ex:
{
  int b;
  luaL_checktype(L, 1, LUA_TNUMBER);
  b=SPI(lua_tointeger(L, 1));
  lua_pushinteger(L, b);
  return 1;
}

4. Lua operates by pushing and popping into a lua stack.how does it help and why it is needed to do so??

I know there are reading materials available, but I want to know a simple explanation to the above questions. I know its silly questions but a little guide would be great..thank you

With Regards
Bis