summaryrefslogtreecommitdiff
path: root/src/luascript.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-12-27 11:05:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2018-12-27 11:05:52 +0100
commitf4729babb394fbd41b55fba5c53bfc6afe1cda09 (patch)
tree492f7696ed5d36d238ddd14048800ff919930fad /src/luascript.cc
parentcf19a88c5a37fead401df39849ad7ba56aaa851d (diff)
Add file menu with load/save etc.
Diffstat (limited to 'src/luascript.cc')
-rw-r--r--src/luascript.cc28
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);