From e0167298afed239791f4394280ad2e192eaf2eeb Mon Sep 17 00:00:00 2001 From: ve5li Date: Tue, 12 Sep 2023 14:05:33 +0200 Subject: [PATCH] fix: check for escaped keys and handle them correctly Original author is @vE5li. The commit was resigned in order to be merged upstream. --- lua/libmodal/collections/ParseTable.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/libmodal/collections/ParseTable.lua b/lua/libmodal/collections/ParseTable.lua index 6baabdd..19a5af6 100644 --- a/lua/libmodal/collections/ParseTable.lua +++ b/lua/libmodal/collections/ParseTable.lua @@ -39,6 +39,22 @@ local function get(parse_table, lhs_reversed_bytes) return parse_table end + local out = k + + if type(k) == "string" then + for index = 1, #k do + local character = k:byte(index) + + if index == 1 then + out = character + else + table.insert(lhs_reversed_bytes, 1, character) + end + end + end + + k = out + --[[ Parse the `k`. ]] -- make sure the dicitonary has a key for that value.