diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2024-05-07 23:00:41 +0200 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2024-05-07 23:00:41 +0200 |
| commit | 1d64b5790f26760cb830336ccca9d51474b73ae8 (patch) | |
| tree | 26877b8423e51f7672b95707bda98a115e9d0eec /system | |
| parent | c8a2d1d2dacde9fea43ebbacf924707d563cf99a (diff) | |
| download | luasystem-1d64b5790f26760cb830336ccca9d51474b73ae8.tar.gz luasystem-1d64b5790f26760cb830336ccca9d51474b73ae8.tar.bz2 luasystem-1d64b5790f26760cb830336ccca9d51474b73ae8.zip | |
localize unpack
Diffstat (limited to 'system')
| -rw-r--r-- | system/init.lua | 7 |
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 | |||
| 244 | local left_over_key | 244 | local left_over_key |
| 245 | local sequence -- table to store the sequence in progress | 245 | local sequence -- table to store the sequence in progress |
| 246 | local utf8_length -- length of utf8 sequence currently being processed | 246 | local utf8_length -- length of utf8 sequence currently being processed |
| 247 | local unpack = unpack or table.unpack | ||
| 247 | 248 | ||
| 248 | -- Reads a single key, if it is the start of ansi escape sequence then it reads | 249 | -- Reads a single key, if it is the start of ansi escape sequence then it reads |
| 249 | -- the full sequence. | 250 | -- the full sequence. |
| @@ -320,7 +321,7 @@ do | |||
| 320 | 321 | ||
| 321 | if #sequence == utf8_length then | 322 | if #sequence == utf8_length then |
| 322 | -- end of sequence, return the full sequence | 323 | -- end of sequence, return the full sequence |
| 323 | local result = string.char((unpack or table.unpack)(sequence)) | 324 | local result = string.char(unpack(sequence)) |
| 324 | sequence = nil | 325 | sequence = nil |
| 325 | utf8_length = nil | 326 | utf8_length = nil |
| 326 | return result, "char" | 327 | return result, "char" |
| @@ -339,7 +340,7 @@ do | |||
| 339 | 340 | ||
| 340 | if (key >= 65 and key <= 90) or (key >= 97 and key <= 126) then | 341 | if (key >= 65 and key <= 90) or (key >= 97 and key <= 126) then |
| 341 | -- end of sequence, return the full sequence | 342 | -- end of sequence, return the full sequence |
| 342 | local result = string.char((unpack or table.unpack)(sequence)) | 343 | local result = string.char(unpack(sequence)) |
| 343 | sequence = nil | 344 | sequence = nil |
| 344 | return result, "ansi" | 345 | return result, "ansi" |
| 345 | end | 346 | end |
| @@ -347,7 +348,7 @@ do | |||
| 347 | end | 348 | end |
| 348 | 349 | ||
| 349 | -- error, or timeout reached, return the sequence so far | 350 | -- error, or timeout reached, return the sequence so far |
| 350 | local partial = string.char((unpack or table.unpack)(sequence)) | 351 | local partial = string.char(unpack(sequence)) |
| 351 | return nil, err, partial | 352 | return nil, err, partial |
| 352 | end | 353 | end |
| 353 | end | 354 | end |
