lua-users home
lua-l archive

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


On Sat, Dec 4, 2010 at 6:42 PM, Peyman <peiman_3009@yahoo.com> wrote:
> this is possible to know a function in lua is exist before i want call it with lua_call ?

>From the manual:
"int lua_isfunction (lua_State *L, int index);

Returns 1 if the value at the given acceptable index is a function
(either C or Lua), and 0 otherwise."

So if you get your function somewhere (maybe look it up globally) then
lua_isfunction(L,-1) will tell you if the object on the top of the
stack is indeed a function.

steve d.