Skip to content

Commit

Permalink
WTS: Add position support to unpack
Browse files Browse the repository at this point in the history
Issue: #99
  • Loading branch information
nvs committed Jul 4, 2022
1 parent 9b63654 commit e84d43e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions file/war3map/wts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ local WTS = {}

local BOM = '\xEF\xBB\xBF'

function WTS.unpack (input)
assert (type (input) == 'string')
function WTS.unpack (input, position)
input = input:sub (position)

local output = {}
local pattern = 'STRING (%d+)\r\n(.-){\r\n([^}]-)\r\n}'
Expand All @@ -15,7 +15,7 @@ function WTS.unpack (input)
}
end

return output
return output, #input + 1
end

function WTS.pack (input)
Expand Down

0 comments on commit e84d43e

Please sign in to comment.