diff options
Diffstat (limited to 'client/lua.cc')
-rw-r--r-- | client/lua.cc | 18 |
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) { |