From b0dc3a2d84765251000b87ff9fc63ed4d48a72f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 14 Jun 2015 13:53:11 +0200 Subject: [PATCH] Fixed `keyboard.isKeyDown` for chars (strings), making use of the utf8 lib when available (Lua 5.3). Closes #1214. Thanks to @bawr for pointing out the bug in the first place. --- .../resources/assets/opencomputers/loot/OpenOS/lib/keyboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/keyboard.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/keyboard.lua index 875e6bd7a..4271ef4b9 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/keyboard.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/keyboard.lua @@ -159,7 +159,7 @@ end function keyboard.isKeyDown(charOrCode) checkArg(1, charOrCode, "string", "number") if type(charOrCode) == "string" then - return keyboard.pressedChars[charOrCode] + return keyboard.pressedChars[utf8 and utf8.codepoint(charOrCode) or charOrCode:byte()] elseif type(charOrCode) == "number" then return keyboard.pressedCodes[charOrCode] end