diff options
-rw-r--r-- | include/LuaTask.h | 7 | ||||
-rw-r--r-- | lib/LuaTask.cc | 41 |
2 files changed, 46 insertions, 2 deletions
diff --git a/include/LuaTask.h b/include/LuaTask.h index 221646f..cd97900 100644 --- a/include/LuaTask.h +++ b/include/LuaTask.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.h,v 1.6 2007-12-20 17:06:29 pixel Exp $ */ +/* $Id: LuaTask.h,v 1.7 2007-12-25 15:06:12 pixel Exp $ */ #ifndef __LUATASK_H__ #define __LUATASK_H__ @@ -54,4 +54,9 @@ class LuaTask : public Task { static htab * h; }; +class LuaTaskMan : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); +}; + #endif diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc index f7497be..754b136 100644 --- a/lib/LuaTask.cc +++ b/lib/LuaTask.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.cc,v 1.18 2007-10-15 13:47:12 pixel Exp $ */ +/* $Id: LuaTask.cc,v 1.19 2007-12-25 15:06:12 pixel Exp $ */ #include <LuaTask.h> #include <LuaHandle.h> @@ -278,3 +278,42 @@ int LuaTask::Do() throw (GeneralException) { return TASK_ON_HOLD; } + +enum TaskMan_functions_t { + TASKMAN_NB_TASKS = 0, + TASKMAN_NB_ZOMBIES, +}; + +struct lua_functypes_t TaskMan_functions[] = { + { TASKMAN_NB_TASKS, "NB_Tasks", 0, 0, { } }, + { TASKMAN_NB_ZOMBIES, "NB_Zombies", 0, 0, { } }, + { -1, 0, 0, 0, 0 } +}; + +class sLua_TaskMan : public Base { + public: + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); + private: + static int TaskMan_proceed_statics(Lua * L, int n, int caller); +}; + +void LuaTaskMan::pushstatics(Lua * L) throw (GeneralException) { + CHECK_FUNCTIONS(TaskMan); + + PUSH_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + PUSH_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); +} + +int sLua_TaskMan::TaskMan_proceed_statics(Lua * L, int n, int caller) { + switch (caller) { + case TASKMAN_NB_TASKS: + return TaskMan::nb_tasks(); + break; + case TASKMAN_NB_ZOMBIES: + return TaskMan::nb_zombies(); + break; + } + + return 1; +} |