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 5, 2022
1 parent d7c03a2 commit 5bd3944
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 5bd3944

Please sign in to comment.