diff options
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r-- | src/FbCommands.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 9f3acdc..c789b6b 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" |
@@ -627,6 +627,15 @@ REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(lua, LuaCmd, void); | |||
627 | 627 | ||
628 | namespace { | 628 | namespace { |
629 | const char LuaCmds[] = "FbCommands::LuaCmd"; | 629 | const char LuaCmds[] = "FbCommands::LuaCmd"; |
630 | |||
631 | void initLuaCmds(FbTk::Lua &l) { | ||
632 | l.checkstack(1); | ||
633 | |||
634 | l.newtable(); | ||
635 | l.rawsetfield(lua::REGISTRYINDEX, LuaCmds); | ||
636 | } | ||
637 | |||
638 | FbTk::Lua::RegisterInitFunction register_init_lua_cmds(&initLuaCmds); | ||
630 | } | 639 | } |
631 | 640 | ||
632 | LuaCmd::LuaCmd(const std::string &chunk) { | 641 | LuaCmd::LuaCmd(const std::string &chunk) { |
@@ -651,14 +660,6 @@ void LuaCmd::init(lua::state &l) { | |||
651 | l.checkstack(2); | 660 | l.checkstack(2); |
652 | 661 | ||
653 | l.rawgetfield(lua::REGISTRYINDEX, LuaCmds); { | 662 | l.rawgetfield(lua::REGISTRYINDEX, LuaCmds); { |
654 | if(l.isnil(-1)) { | ||
655 | l.pop(); | ||
656 | l.newtable(); | ||
657 | |||
658 | l.pushvalue(-1); | ||
659 | l.rawsetfield(lua::REGISTRYINDEX, LuaCmds); | ||
660 | } | ||
661 | |||
662 | l.pushvalue(-2); | 663 | l.pushvalue(-2); |
663 | m_ref = l.ref(-2); | 664 | m_ref = l.ref(-2); |
664 | } l.pop(); | 665 | } l.pop(); |