From 4a3242eb3e65795be9e8d269dcd36c9b9a1256e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 7 Mar 2016 15:32:00 +0100 Subject: [PATCH] Use unicode sub for gpu.fill, fixes #7 --- src/lua/core/fbgpu.lua | 2 +- src/lua/core/winapigpu.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lua/core/fbgpu.lua b/src/lua/core/fbgpu.lua index fcffddb..88c2ad9 100644 --- a/src/lua/core/fbgpu.lua +++ b/src/lua/core/fbgpu.lua @@ -147,7 +147,7 @@ function fbgpu.start() checkArg(3, w, "number") checkArg(4, h, "number") checkArg(5, ch, "string") - ch = ch:sub(1, 1) + ch = usub(ch, 1, 1) fb.fill(x-1, y-1, x+w-2, y+h-2, background, foreground, utf8.codepoint(ch)) return true end diff --git a/src/lua/core/winapigpu.lua b/src/lua/core/winapigpu.lua index 506fec5..cc3b735 100644 --- a/src/lua/core/winapigpu.lua +++ b/src/lua/core/winapigpu.lua @@ -22,7 +22,10 @@ end local background = 0 local foreground = 0 +local usub + function wingpu.start() + usub = modules.sandbox.unicode.sub local gpu = {} function gpu.bind() return false, "This is static bound gpu" end @@ -135,7 +138,7 @@ function wingpu.start() checkArg(3, w, "number") checkArg(4, h, "number") checkArg(5, ch, "string") - ch = ch:sub(1, 1) + ch = usub(ch, 1, 1) win.fill(x-1, y-1, x+w-2, y+h-2, background, foreground, utf8.codepoint(ch)) return true end