How would I make a C-function that I can call from Lua? -
i know how make c-function , able tell lua it, call lua. have lua libraries installed on mac osx 10.4 computer.
there's excellent example of lua-c integration here , here.
if need export function global namespace, then:
- declare function (let's call
f) signaturelua_cfunction. - call
lua_register(l, "myfunc", f), l being lua state, , function =f. - run lua code.
favailable in global namespacemyfunc.
if you're going use stock interpreter might want make library. this guy wrote article lua programming gems explains how it. sources available online.
Comments
Post a Comment