lua-users home
lua-l archive

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


>it possible to register a C function  "int average(int a, int >b) { return (a+b)/2;}" to lua ?

No, it's not. C functions to be used with Lua must follow a protocol to receive
and send results. There are tools that make this glue code automatically and
so it may seem that an ordinary C function is being exported to Lua as is, but
this is an illusion (but a very nice one). Look for "code wrappers" in
lua-users.org.
--lhf