private static int OnPlay(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); TweenParams tweenParams = (TweenParams)ToLua.CheckObject(L, 1, typeof(TweenParams)); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); TweenCallback action; if (luaTypes != LuaTypes.LUA_TFUNCTION) { action = (TweenCallback)ToLua.CheckObject(L, 2, typeof(TweenCallback)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); action = (DelegateFactory.CreateDelegate(typeof(TweenCallback), func) as TweenCallback); } TweenParams o = tweenParams.OnPlay(action); ToLua.PushObject(L, o); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }