static int _CreateLuaMediator(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { string arg0 = ToLua.CheckString(L, 1); LuaMediator obj = new LuaMediator(arg0); ToLua.PushObject(L, obj); return(1); } else if (count == 2) { string arg0 = ToLua.CheckString(L, 1); object arg1 = ToLua.ToVarObject(L, 2); LuaMediator obj = new LuaMediator(arg0, arg1); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaMediator.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void RegisterLuaMediator(string mediatorName) { luaEnv.DoString("require '" + mediatorName + "'"); ILuaMediator mediator = new LuaMediator(); mediator.NAME = luaEnv.Global.GetInPath <string>(mediatorName + ".NAME"); mediator.ListNotificationInterests = luaEnv.Global.GetInPath <List <string> >(mediatorName + ".ListNotificationInterests"); mediator.OnRegister = luaEnv.Global.GetInPath <Action>(mediatorName + ".OnRegister"); mediator.OnRemove = luaEnv.Global.GetInPath <Action>(mediatorName + ".OnRemove"); mediator.HandleNotification = luaEnv.Global.GetInPath <HandleNotification>(mediatorName + ".HandleNotification"); base.RegisterLuaMediator(mediator); }
static int OnRegister(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaMediator obj = (LuaMediator)ToLua.CheckObject <LuaMediator>(L, 1); obj.OnRegister(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int HandleNotification(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaMediator obj = (LuaMediator)ToLua.CheckObject <LuaMediator>(L, 1); PureMVC.Interfaces.INotification arg0 = (PureMVC.Interfaces.INotification)ToLua.CheckObject <PureMVC.Interfaces.INotification>(L, 2); obj.HandleNotification(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ListNotificationInterests(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaMediator obj = (LuaMediator)ToLua.CheckObject <LuaMediator>(L, 1); string[] o = obj.ListNotificationInterests(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_Mediator(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaMediator obj = (LuaMediator)o; LuaInterface.LuaTable ret = obj.Mediator; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Mediator on a nil value")); } }