mirror of
https://github.com/smogon/sprites.git
synced 2026-09-14 13:05:57 -05:00
add spritedata()
This commit is contained in:
15
util/sprites.lua
Normal file
15
util/sprites.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
function spritedata(basename)
|
||||
local iter = basename:gmatch("[^-]+")
|
||||
local result = {id = iter(), data = {}}
|
||||
for flagtext in iter do
|
||||
if flagtext:len() == 1 then
|
||||
result.data[flagtext] = true
|
||||
else
|
||||
local flag = flagtext.sub(1, 1)
|
||||
local text = flagtext.sub(2)
|
||||
result.data[flag] = text
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
Reference in New Issue
Block a user