fix annotation parsing

ref: #2857
develop
Myk Taylor 2023-02-10 08:15:44 -08:00
parent e160bd0607
commit 960bfaca86
No known key found for this signature in database
1 changed files with 6 additions and 4 deletions

@ -657,16 +657,18 @@ function Script:get_flags()
self.flags_mtime = mtime self.flags_mtime = mtime
self._flags = {} self._flags = {}
local f = io.open(self.path) local f = io.open(self.path)
local contents = f:read('*all') for line in f:lines() do
f:close() local at_tag = line:match('^%-%-@(.+)')
for line in contents:gmatch('^%-%-@([^\n]+)') do if not at_tag then goto continue end
local chunk = load(line, self.path, 't', self._flags) local chunk = load(at_tag, self.path, 't', self._flags)
if chunk then if chunk then
chunk() chunk()
else else
dfhack.printerr('Parse error: ' .. line) dfhack.printerr('Parse error: ' .. line)
end end
::continue::
end end
f:close()
end end
return self._flags return self._flags
end end