lua-users home
lua-l archive

Re: Calling C functions from Lua 5.2

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


On 2012年4月24日 16:31:51 -0400
"James Urso" <JUrso@walchem.com> wrote:
> Is there something I can do so that I don't need to have the "th." In
> front of the call to the buildMessage function in the C library?
> Eventually, I plan to take the function call out of here and pass in
> an input file name as a command line parameter. The input file will
> be the script file written by the software developers and it will
> simply contain a series of buildMessage() calls and calls to other
> soon-to-be-developed functions.
> 
> For simplicity, I would prefer that the developers not have to put
> "th." In front of every function call. I've Googled for answers but
> haven't really found any. One webpage I found had an example that
> seemed to do what I wanted, but it was written in Lua 5.1 and used
> some deprecated functions. Any suggestions to solve this issue would
> be appreciated.
> 
The call to luaL_newlib() creates a table on the stack and then
populates the table with functions. Then your code returns that table.
T
lua_register

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