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 = {}
local f = io.open(self.path)
local contents = f:read('*all')
f:close()
for line in contents:gmatch('^%-%-@([^\n]+)') do
local chunk = load(line, self.path, 't', self._flags)
for line in f:lines() do
local at_tag = line:match('^%-%-@(.+)')
if not at_tag then goto continue end
local chunk = load(at_tag, self.path, 't', self._flags)
if chunk then
chunk()
else
dfhack.printerr('Parse error: ' .. line)
end
::continue::
end
f:close()
end
return self._flags
end