1

Is there a way to map classes directly to C# functions by just loading the class? Instead of making 100+ RegisterFunctions and mapping them?

EX: Something like

this.lua = new LuaInterface.Lua();
RegisterAll(Class1.MainClass);
lua.DoFile(this.filePath);

inside lua:

function Start
    MainClass.MappedPrintFunc("hihi");
end
Picrofo Software
  • 5,475
  • 3
  • 23
  • 37
Vans S
  • 1,743
  • 3
  • 21
  • 36
  • I don't know LuaInterface. Hence, I think it it physically _possible_, because .NET, unlike C++, has the knowledge of class interface. – prapin Nov 02 '12 at 06:15

1 Answers1

2

You can do so by setting a variable in LUA to your function that exports funcs or props.

EX:

Class Manager()
public static GameLocalPlayer LocalPlayer { get; set; }

LuaInterace lua = new LuaInterface;
lua["variablename"]=Manager.LocalPlayer;  

---lua----
variablename.Health;
variablename:AttackTarget(target);
Vans S
  • 1,743
  • 3
  • 21
  • 36