diff --git a/MWSE/mods/Keyboard Layout Changer/common.lua b/MWSE/mods/Keyboard Layout Changer/common.lua index 25a1a31..07f74a4 100644 --- a/MWSE/mods/Keyboard Layout Changer/common.lua +++ b/MWSE/mods/Keyboard Layout Changer/common.lua @@ -1,8 +1,7 @@ local keys = require("Keyboard Layout Changer.keys") + local supportedLayouts = "" -for name, _ in pairs(keys) do - supportedLayouts = supportedLayouts .. name .. " " -end +for name, _ in pairs(keys) do supportedLayouts = supportedLayouts .. name .. " " end local this = {} @@ -15,9 +14,15 @@ this.modInfo = "Allows use of non-qwerty keyboard layouts.\n\nCurrently supporte function this.log(str) mwse.log("[%s] %s", this.modName, str) end function this.changeLayout(layout) - -- Thanks NullCascade - mwse.memory.writeBytes({address = 0x775148, bytes = keys[layout].lowercase}) - mwse.memory.writeBytes({address = 0x775248, bytes = keys[layout].uppercase}) + if keys[layout] and (#keys[layout].lowercase == 256 and #keys[layout].uppercase == 256) then + -- Thanks NullCascade + mwse.memory.writeBytes({address = 0x775148, bytes = keys[layout].lowercase}) + mwse.memory.writeBytes({address = 0x775248, bytes = keys[layout].uppercase}) + else + local message = "Bad keys.lua file, please re-install." + this.log(message) + tes3.messageBox(string.format("(%s) %s", this.modName, message)) + end end return this