lua-users home
lua-l archive

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


Hallo,

Robert Kücken wrote:

Hm, I took the example from the manual, the foo-function as my
C-function. Sorry, but I don't know how to use the lua_register()
macro and the lua_pushcfunction() function. Could you give me an
example, please? thank you alex

	
Ok, so if you had the C function int _foo(lua_State* L) and you want your Lua scripts to be able to call it, The easiest way to do it is to call lua_register(L, "foo", _foo). That is a macro that's gonna register your function in the Lua environment with the name "foo".

--
Alex Queiroz