Reputation: 1813
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
Upvotes: 1
Views: 1650
Reputation: 1813
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);
Upvotes: 2