From 45577b6e19924e5c193cf0fa65fac4b985dca987 Mon Sep 17 00:00:00 2001 From: vE5li Date: Tue, 19 Sep 2023 18:24:42 +0200 Subject: [PATCH] fix: check for escaped keys and handle them correctly (#23) 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.