summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2012-04-03 08:32:34 -0700
committerPixel <pixel@nobis-crew.org>2012-04-03 08:32:34 -0700
commit7d5f246ae7310055d39ea13ff395d830e3c27a60 (patch)
tree71ca074922cebb539d6c97c035abbf59b8975d55
parent33defc102694ea3af83d7f20fd525f08cc7d174d (diff)
Opening all libraries in the LuaMainTask, and adding the LuaExecFile class.
-rw-r--r--includes/LuaTask.h10
-rw-r--r--src/LuaTask.cc14
2 files changed, 23 insertions, 1 deletions
diff --git a/includes/LuaTask.h b/includes/LuaTask.h
index 6dff44e..bdde9b7 100644
--- a/includes/LuaTask.h
+++ b/includes/LuaTask.h
@@ -30,6 +30,14 @@ class LuaExecString : public LuaExecCell {
String m_str;
};
+class LuaExecFile : public LuaExecCell {
+ public:
+ LuaExecFile(IO<Handle> file) : m_file(file) { }
+ private:
+ virtual void run(Lua &);
+ IO<Handle> m_file;
+};
+
class LuaTask : public Task {
public:
~LuaTask() { L.weaken(); }
@@ -44,7 +52,7 @@ class LuaTask : public Task {
class LuaMainTask : public Task {
public:
- LuaMainTask() : m_stopping(false) { }
+ LuaMainTask();
~LuaMainTask() { L.close(); }
void stop();
virtual const char * getName() const { return "LuaMainTask"; }
diff --git a/src/LuaTask.cc b/src/LuaTask.cc
index d722847..9a7e978 100644
--- a/src/LuaTask.cc
+++ b/src/LuaTask.cc
@@ -2,6 +2,16 @@
#include "Main.h"
#include "TaskMan.h"
+Balau::LuaMainTask::LuaMainTask() : m_stopping(false) {
+ L.open_base();
+ L.open_table();
+ L.open_string();
+ L.open_math();
+ L.open_debug();
+ L.open_bit();
+ L.open_jit();
+}
+
void Balau::LuaMainTask::exec(LuaExecCell * cell) {
m_queue.push(cell);
m_queueEvent.trigger();
@@ -43,3 +53,7 @@ void Balau::LuaExecCell::exec(LuaMainTask * mainTask) {
void Balau::LuaExecString::run(Lua & L) {
L.load(m_str);
}
+
+void Balau::LuaExecFile::run(Lua & L) {
+ L.load(m_file);
+}