summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-05-07 23:00:41 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2024-05-07 23:00:41 +0200
commit1d64b5790f26760cb830336ccca9d51474b73ae8 (patch)
tree26877b8423e51f7672b95707bda98a115e9d0eec
parentc8a2d1d2dacde9fea43ebbacf924707d563cf99a (diff)
downloadluasystem-1d64b5790f26760cb830336ccca9d51474b73ae8.zip
localize unpack
-rw-r--r--system/init.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/system/init.lua b/system/init.lua
index 94c2f09..893cd91 100644
--- a/system/init.lua
+++ b/system/init.lua
@@ -244,6 +244,7 @@ do
local left_over_key
local sequence -- table to store the sequence in progress
local utf8_length -- length of utf8 sequence currently being processed
+ local unpack = unpack or table.unpack
-- Reads a single key, if it is the start of ansi escape sequence then it reads
-- the full sequence.
@@ -320,7 +321,7 @@ do
if #sequence == utf8_length then
-- end of sequence, return the full sequence
- local result = string.char((unpack or table.unpack)(sequence))
+ local result = string.char(unpack(sequence))
sequence = nil
utf8_length = nil
return result, "char"
@@ -339,7 +340,7 @@ do
if (key >= 65 and key <= 90) or (key >= 97 and key <= 126) then
-- end of sequence, return the full sequence
- local result = string.char((unpack or table.unpack)(sequence))
+ local result = string.char(unpack(sequence))
sequence = nil
return result, "ansi"
end
@@ -347,7 +348,7 @@ do
end
-- error, or timeout reached, return the sequence so far
- local partial = string.char((unpack or table.unpack)(sequence))
+ local partial = string.char(unpack(sequence))
return nil, err, partial
end
end