From 51122d8689f6fbb1061ee0b19f885ad8851dfd50 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 13 Aug 2010 10:07:22 +0000 Subject: Clear lua when reopening a macro window. --- client/lua.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'client/lua.cc') 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) { -- cgit v1.2.3