public override void Setup(LuaTable table) { table.SetValue("assert", (Func<bool, object, object[], Varargs>)Assert); table.SetValue("collectgarbage", (Action<string, string>)CollectGarbage); table.SetValue("dofile", (Func<string, object>)DoFile); table.SetValue("error", (Action<string, object>)Error); table.SetValue("_G", table); table.SetValue("getfenv", (Func<object, object>)GetFEnv); table.SetValue("getmetatable", (Func<object, object>)GetMetatable); table.SetValue("ipairs", (Func<LuaTable, Varargs>)IPairs); table.SetValue("load", (Func<Delegate, string, Varargs>)Load); table.SetValue("loadfile", (Func<string, Varargs>)LoadFile); table.SetValue("loadstring", (Func<string, string, Varargs>)LoadString); table.SetValue("next", (Func<LuaTable, object, Varargs>)Next); table.SetValue("pairs", (Func<LuaTable, Varargs>)Pairs); table.SetValue("pcall", (Func<Delegate, object[], Varargs>)PCall); table.SetValue("print", (Action<object[]>)Print); table.SetValue("rawequal", (Func<object, object, bool>)RawEqual); table.SetValue("rawget", (Func<LuaTable, object, object>)RawGet); table.SetValue("rawset", (Func<LuaTable, object, object, object>)RawSet); table.SetValue("select", (Func<object, object[], Varargs>)Select); table.SetValue("setfenv", (Func<object, LuaTable, object>)SetFEnv); table.SetValue("setmetatable", (Func<LuaTable, LuaTable, LuaTable>)SetMetatable); table.SetValue("tonumber", (Func<string, object, object>)ToNumber); table.SetValue("tostring", (Func<object, object>)ToString); table.SetValue("type", (Func<object, string>)Type); table.SetValue("unpack", (Func<LuaTable, object, object, Varargs>)Unpack); table.SetValue("_VERSION", Constant.LUA_VERSION); table.SetValue("xpcall", (Func<Delegate, Delegate, Varargs>)XPCall); }
public LuaTable RawSet(LuaTable table, object index, object value) { table.SetValue(index, value); return table; }
void SetupLibraries() { Globals = new LuaTable(); BaseLibrary = new BaseLibrary(this); BaseLibrary.Setup(Globals); //TableLibrary = new TableLibrary(); var tablelibTable = new LuaTable(); //TableLibrary.Setup(tablelibTable); Globals.SetValue("table", tablelibTable); MathLibrary = new MathLibrary(this); var mathlibTable = new LuaTable(); MathLibrary.Setup(mathlibTable); Globals.SetValue("math", mathlibTable); StringLibrary = new StringLibrary(this); var strlibTable = new LuaTable(); StringLibrary.Setup(strlibTable); Globals.SetValue("string", strlibTable); //IoLibrary = new IoLibrary(this); var iolibTable = new LuaTable(); //IoLibrary.Setup(iolibTable); Globals.SetValue("io", iolibTable); OSLibrary = new OSLibrary(this); var oslibTable = new LuaTable(); OSLibrary.Setup(oslibTable); Globals.SetValue("os", oslibTable); //DebugLibrary = new DebugLibrary(this); var debuglibTable = new LuaTable(); //DebugLibrary.Setup(debuglibTable); Globals.SetValue("debug", debuglibTable); }