summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
+}