From 713a2a8e081e410ef7b536843487661918a08741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dexter=20Castor=20D=C3=B6pping?= Date: Sun, 4 Aug 2024 19:29:55 +0200 Subject: [PATCH] NXML: Match Noita's duplicate attribute behaviour --- component-explorer/deps/nxml.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/component-explorer/deps/nxml.lua b/component-explorer/deps/nxml.lua index b248b36..eea4bb1 100644 --- a/component-explorer/deps/nxml.lua +++ b/component-explorer/deps/nxml.lua @@ -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)