diff options
Diffstat (limited to 'srcinfo.lua')
-rw-r--r-- | srcinfo.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/srcinfo.lua b/srcinfo.lua index 855502a..058b9c6 100644 --- a/srcinfo.lua +++ b/srcinfo.lua @@ -15,6 +15,16 @@ end local +function shallow (list) + local new = {} + for i, value in ipairs(list) do + new[i] = value + end + return new +end + + +local function apply (state, method, ...) if state[method] then return state[method](state, ...) @@ -65,7 +75,9 @@ function srcinfo (text, options) else local current_value = self.current[name] if type(current_value) == "table" then + current_value = shallow(current_value) -- Wasteful, but won't spill table.insert(current_value, value) + self.current[name] = current_value elseif current_value ~= nil then self.current[name] = {current_value, value} else |