diff --git a/apps/openmw/mwlua/inputbindings.cpp b/apps/openmw/mwlua/inputbindings.cpp index 02babf0399..41b2b5c94f 100644 --- a/apps/openmw/mwlua/inputbindings.cpp +++ b/apps/openmw/mwlua/inputbindings.cpp @@ -24,6 +24,12 @@ namespace MWLua sol::table initInputPackage(const Context& context) { + { + sol::state_view& lua = context.mLua->sol(); + if (lua["openmw_input"] != sol::nil) + return lua["openmw_input"]; + } + sol::usertype<SDL_Keysym> keyEvent = context.mLua->sol().new_usertype<SDL_Keysym>("KeyEvent"); keyEvent["symbol"] = sol::readonly_property([](const SDL_Keysym& e) { if (e.sym > 0 && e.sym <= 255) @@ -291,7 +297,9 @@ namespace MWLua { "Tab", SDL_SCANCODE_TAB }, })); - return LuaUtil::makeReadOnly(api); + sol::state_view& lua = context.mLua->sol(); + lua["openmw_input"] = LuaUtil::makeReadOnly(api); + return lua["openmw_input"]; } } diff --git a/apps/openmw/mwlua/luabindings.cpp b/apps/openmw/mwlua/luabindings.cpp index 931cd43296..a7269d6e52 100644 --- a/apps/openmw/mwlua/luabindings.cpp +++ b/apps/openmw/mwlua/luabindings.cpp @@ -76,13 +76,11 @@ namespace MWLua std::map<std::string, sol::object> initMenuPackages(const Context& context) { return { - { "openmw.core", initCorePackageForMenuScripts(context) }, // - { "openmw.ambient", initAmbientPackage(context) }, // - { "openmw.ui", initUserInterfacePackage(context) }, // + { "openmw.core", initCorePackageForMenuScripts(context) }, + { "openmw.ambient", initAmbientPackage(context) }, + { "openmw.ui", initUserInterfacePackage(context) }, { "openmw.menu", initMenuPackage(context) }, - // TODO: Maybe add: - // { "openmw.input", initInputPackage(context) }, - // { "openmw.postprocessing", initPostprocessingPackage(context) }, + { "openmw.input", initInputPackage(context) }, }; } } diff --git a/files/data/scripts/omw/console/menu.lua b/files/data/scripts/omw/console/menu.lua index 1aa3e7b166..9d6dbaf1d7 100644 --- a/files/data/scripts/omw/console/menu.lua +++ b/files/data/scripts/omw/console/menu.lua @@ -50,6 +50,7 @@ local env = { ambient = require('openmw.ambient'), async = require('openmw.async'), ui = require('openmw.ui'), + input = require('openmw.input'), aux_util = require('openmw_aux.util'), view = require('openmw_aux.util').deepToString, print = printToConsole,