2

我为 Lua 脚本扩展了 delphi 应用程序。我想知道是否有任何方法可以自动注册我所有的对象函数?我知道当我想注册一些函数时,它必须是 luaCFunction。我得到了这样的东西:

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;

我想要的是我不想为我的每个函数都写这样的函数。有什么方法可以将所有这些函数从delphi对象注册到lua?我使用这个包装

感谢你的帮助。

4

0 回答 0