lua-users home
lua-l archive

Re: Function lua_register

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


> > I would like to know if it is possible to register a function
> > C with TWO or more arguments.
> >
>
> 	Every C funtion to be registered in Lua must have only one
> argument because when in Lua functions have any number of arguments.
This is misleading. The single argument passed to a C function is the
lua_State pointer, and the reason for having this argument is so that you
know which Lua state you are referring to (because the Lua API calls all
take a state parameter).
> To obtain those one must use the stack referenced by the lua_State
> passed to the C function.
Exactly. The standard libraries are a good source of examples.
-- 
http://sc3d.org/rrt/ | competent, a. underpromoted

AltStyle によって変換されたページ (->オリジナル) /