Automatic registering delphi function to Lua

319 Views Asked by At

im extending delphi app for Lua scripting. And i am wondering if is there any way to automatically register all my object functions? I know when i want to register some function it has to be luaCFunction. i got something like this:

function RegisterMyPersonFunction(l : PLua_State) : Integer; cdecl;
var
  person : TLuaPerson;    
  Age: Integer;
begin

  if (lua_gettop(l) < 1) then 
    exit;

  person := TLuaPerson(LuaToTLuaObject(l, 1)); 
  Age:=luaL_checkinteger(l,2);
  person.SetAge(Age);
  result := 0;

end;

What i want is that i dont want to write for every my function own function like this. Is there any way how to register all these functions from delphi object to lua? Im using this wrapper

Thanks for all your help.

0

There are 0 best solutions below