changeLayout function takes string instead of whole table

This commit is contained in:
Lilian Jónsdóttir 2020-07-09 23:39:07 -07:00
parent 78c2065378
commit 53eef6f083
3 changed files with 5 additions and 6 deletions

View file

@ -14,10 +14,10 @@ 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.log(str) mwse.log("[%s] %s", this.modName, str) end
function this.changeLayout(keys) function this.changeLayout(layout)
-- Thanks NullCascade -- Thanks NullCascade
mwse.memory.writeBytes({address = 0x775148, bytes = keys.lowercase}) mwse.memory.writeBytes({address = 0x775148, bytes = keys[layout].lowercase})
mwse.memory.writeBytes({address = 0x775248, bytes = keys.uppercase}) mwse.memory.writeBytes({address = 0x775248, bytes = keys[layout].uppercase})
end end
return this return this

View file

@ -1,10 +1,9 @@
local keys = require("Keyboard Layout Changer.keys")
local common = require("Keyboard Layout Changer.common") local common = require("Keyboard Layout Changer.common")
local config = require("Keyboard Layout Changer.config").getConfig() local config = require("Keyboard Layout Changer.config").getConfig()
local function onInitialized() local function onInitialized()
common.log("Changing layout to " .. config.keyboardLayout) common.log("Changing layout to " .. config.keyboardLayout)
common.changeLayout(keys[config.keyboardLayout]) common.changeLayout(config.keyboardLayout)
end end
event.register("initialized", onInitialized) event.register("initialized", onInitialized)

View file

@ -28,7 +28,7 @@ local function applyLayout()
local message = "Changing layout to " .. config.keyboardLayout local message = "Changing layout to " .. config.keyboardLayout
tes3.messageBox(message) tes3.messageBox(message)
common.log(message) common.log(message)
common.changeLayout(keys[config.keyboardLayout]) common.changeLayout(config.keyboardLayout)
end end
local template = mwse.mcm.createTemplate(common.modName) local template = mwse.mcm.createTemplate(common.modName)