summaryrefslogtreecommitdiff
path: root/client/lua.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-13 10:07:22 +0000
committerdeva <deva>2010-08-13 10:07:22 +0000
commit51122d8689f6fbb1061ee0b19f885ad8851dfd50 (patch)
treec0513a8df0eda183226909fccc8b38e3f6e79185 /client/lua.cc
parentc4ecebb7a1f33acb38d51a82788b071186ff3c19 (diff)
Clear lua when reopening a macro window.
Diffstat (limited to 'client/lua.cc')
-rw-r--r--client/lua.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/client/lua.cc b/client/lua.cc
index 7dbdf75..3dd5381 100644
--- a/client/lua.cc
+++ b/client/lua.cc
@@ -75,6 +75,19 @@ LUA::LUA(Widget **rootwidget)
{
this->rootwidget = rootwidget;
+ L = NULL;
+ clear();
+}
+
+LUA::~LUA()
+{
+ lua_close(L);
+}
+
+void LUA::clear()
+{
+ if(L) lua_close(L);
+
L = luaL_newstate();
if(L == NULL) {
error("Could not create LUA state.");
@@ -91,11 +104,6 @@ LUA::LUA(Widget **rootwidget)
register_widget(L);
}
-LUA::~LUA()
-{
- lua_close(L);
-}
-
QString LUA::runParser(QString program)
{
if(L == NULL) {