Skip to content

Commit

Permalink
NXML: Match Noita's duplicate attribute behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
dextercd committed Aug 4, 2024
1 parent b2828a2 commit 713a2a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions component-explorer/deps/nxml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ function PARSER_FUNCS:parse_attr(attr_table, name)
tok = self.tok:next_token()

if tok.type == "string" then
if attr_table[name] ~= nil then
self:report_error("duplicate_attribute", string.format("parsing attribute '%s' - attribute already exists", name))
return
end
attr_table[name] = tok.value
else
self:report_error("missing_attribute_value", string.format("parsing attribute '%s' - expected a string after =, but did not find one"), name)
Expand Down

0 comments on commit 713a2a8

Please sign in to comment.