private static int get_onClick(IntPtr L) { object luaObject = LuaScriptMgr.GetLuaObject(L, 1); TestLuaDelegate testLuaDelegate = (TestLuaDelegate)luaObject; if (testLuaDelegate == null) { LuaTypes luaTypes = LuaDLL.lua_type(L, 1); if (luaTypes == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onClick"); } else { LuaDLL.luaL_error(L, "attempt to index onClick on a nil value"); } } LuaScriptMgr.Push(L, testLuaDelegate.onClick); return(1); }
static int set_onClick(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); TestLuaDelegate obj = (TestLuaDelegate)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onClick"); } else { LuaDLL.luaL_error(L, "attempt to index onClick on a nil value"); } } LuaTypes funcType = LuaDLL.lua_type(L, 3); if (funcType != LuaTypes.LUA_TFUNCTION) { obj.onClick = (TestLuaDelegate.VoidDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(TestLuaDelegate.VoidDelegate)); } else { LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3); obj.onClick = (param0) => { int top = func.BeginPCall(); LuaScriptMgr.Push(L, param0); func.PCall(top, 1); func.EndPCall(top); }; } return(0); }
private static int set_onClick(IntPtr L) { object luaObject = LuaScriptMgr.GetLuaObject(L, 1); TestLuaDelegate testLuaDelegate = (TestLuaDelegate)luaObject; if (testLuaDelegate == null) { LuaTypes luaTypes = LuaDLL.lua_type(L, 1); if (luaTypes == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onClick"); } else { LuaDLL.luaL_error(L, "attempt to index onClick on a nil value"); } } LuaTypes luaTypes2 = LuaDLL.lua_type(L, 3); if (luaTypes2 != LuaTypes.LUA_TFUNCTION) { testLuaDelegate.onClick = (TestLuaDelegate.VoidDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(TestLuaDelegate.VoidDelegate)); } else { LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3); testLuaDelegate.onClick = delegate(GameObject param0) { int oldTop = func.BeginPCall(); LuaScriptMgr.Push(L, param0); func.PCall(oldTop, 1); func.EndPCall(oldTop); }; } return(0); }