aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 0d7c1df..c74cce6 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -31,7 +31,7 @@
31#include "MenuCreator.hh" 31#include "MenuCreator.hh"
32 32
33#include "FbTk/I18n.hh" 33#include "FbTk/I18n.hh"
34#include "FbTk/Luamm.hh" 34#include "FbTk/LuaUtil.hh"
35#include "FbTk/Theme.hh" 35#include "FbTk/Theme.hh"
36#include "FbTk/Menu.hh" 36#include "FbTk/Menu.hh"
37#include "FbTk/CommandParser.hh" 37#include "FbTk/CommandParser.hh"
@@ -547,6 +547,15 @@ REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(lua, LuaCmd, void);
547 547
548namespace { 548namespace {
549 const char LuaCmds[] = "FbCommands::LuaCmd"; 549 const char LuaCmds[] = "FbCommands::LuaCmd";
550
551 void initLuaCmds(FbTk::Lua &l) {
552 l.checkstack(1);
553
554 l.newtable();
555 l.rawsetfield(lua::REGISTRYINDEX, LuaCmds);
556 }
557
558 FbTk::Lua::RegisterInitFunction register_init_lua_cmds(&initLuaCmds);
550} 559}
551 560
552LuaCmd::LuaCmd(const std::string &chunk) { 561LuaCmd::LuaCmd(const std::string &chunk) {
@@ -571,14 +580,6 @@ void LuaCmd::init(lua::state &l) {
571 l.checkstack(2); 580 l.checkstack(2);
572 581
573 l.rawgetfield(lua::REGISTRYINDEX, LuaCmds); { 582 l.rawgetfield(lua::REGISTRYINDEX, LuaCmds); {
574 if(l.isnil(-1)) {
575 l.pop();
576 l.newtable();
577
578 l.pushvalue(-1);
579 l.rawsetfield(lua::REGISTRYINDEX, LuaCmds);
580 }
581
582 l.pushvalue(-2); 583 l.pushvalue(-2);
583 m_ref = l.ref(-2); 584 m_ref = l.ref(-2);
584 } l.pop(); 585 } l.pop();