public static int AddEnemyTask(ILuaState luaState) { EnemyBase enemy = luaState.ToUserData(-2) as EnemyBase; int funcRef = InterpreterManager.GetInstance().RefLuaFunction(luaState); luaState.Pop(1); Task task = ObjectsPool.GetInstance().GetPoolClassAtPool <Task>(); task.funcRef = funcRef; enemy.AddTask(task); return(0); }