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:

  1. declare function (let's call f) signature lua_cfunction.
  2. call lua_register(l, "myfunc", f), l being lua state, , function = f.
  3. run lua code. f available in global namespace myfunc.

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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -