diff options
Diffstat (limited to 'src/luascript.cc')
-rw-r--r-- | src/luascript.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/luascript.cc b/src/luascript.cc index e023a1d..dce5e2c 100644 --- a/src/luascript.cc +++ b/src/luascript.cc @@ -81,7 +81,7 @@ static int _forward(lua_State *L) lua_error(L); } - lua->out->forward(x * 5); + lua->out.forward(x * 5); return 0; } @@ -109,8 +109,8 @@ static int _coord(lua_State *L) lua_error(L); } - lua_pushnumber(L, lua->out->coordX()); - lua_pushnumber(L, lua->out->coordY()); + lua_pushnumber(L, lua->out.coordX()); + lua_pushnumber(L, lua->out.coordY()); return 2; } @@ -142,7 +142,7 @@ static int _loadpen(lua_State *L) lua_error(L); } - lua->out->loadPen(pen); + lua->out.loadPen(pen); return 0; } @@ -174,7 +174,7 @@ static int _speed(lua_State *L) lua_error(L); } - lua->out->setSpeed(x); + lua->out.setSpeed(x); return 0; } @@ -224,7 +224,7 @@ static int _scale(lua_State *L) lua_error(L); } - lua->out->setScale(x); + lua->out.setScale(x); return 0; } @@ -259,7 +259,7 @@ static int _colour(lua_State *L) lua_error(L); } - lua->out->setColour(r,g,b,a); + lua->out.setColour(r,g,b,a); return 0; } @@ -291,7 +291,7 @@ static int _turn(lua_State *L) lua_error(L); } - lua->out->turn(-x * 10); + lua->out.turn(-x * 10); return 0; } @@ -336,7 +336,7 @@ static int _reset(lua_State *L) lua_error(L); } - lua->out->reset(); + lua->out.reset(); return 0; } @@ -372,12 +372,11 @@ void hook(lua_State *L, lua_Debug *ar) //printf(" currentline: %d\n", ar->currentline); } -LUAScript::LUAScript(OutputWindow *o, QString f) +LUAScript::LUAScript(OutputWindow& o) + : out(o) { DEBUG(luascript, "LUAScript()\n"); - file = f; L = NULL; - out = o; // Don't call init from here, it need to be done in the thread. @@ -508,6 +507,11 @@ void LUAScript::runScript() } } +void LUAScript::setScriptFile(QString file) +{ + this->file = file; +} + void LUAScript::sleep(int n) { ::sleep(n); |