mirror of
https://github.com/smogon/sprites.git
synced 2026-03-21 17:35:13 -05:00
add spritedata()
This commit is contained in:
parent
d9115bbfd2
commit
dcd76c548c
|
|
@ -65,8 +65,8 @@ rule(
|
|||
|
||||
local input = {}
|
||||
for file in iter(glob{"newsrc/models/*"}) do
|
||||
local base = tup.base(file)
|
||||
if base:find("-b") or base:find("-s") then
|
||||
local sd = spritedata(tup.base(file))
|
||||
if sd.data.b or sd.data.s then
|
||||
goto continue
|
||||
end
|
||||
input += file
|
||||
|
|
@ -130,7 +130,8 @@ end
|
|||
local dexMissing = {}
|
||||
for file in iter(glob{"newsrc/sprites/gen5/*.gif", "newsrc/models/*.gif"}) do
|
||||
local base = tup.base(file)
|
||||
if base:find("-b") or base:find("-s") or dexSet[base] then
|
||||
local sd = spritedata(base)
|
||||
if sd.data.b or sd.data.s or dexSet[base] then
|
||||
goto continue
|
||||
end
|
||||
dexMissing += file
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
tup.include("util/strict.lua")
|
||||
tup.include("util/lua-ext.lua")
|
||||
tup.include("util/tup-ext.lua")
|
||||
tup.include("util/sprites.lua")
|
||||
|
||||
ROOTDIR = tup.getcwd()
|
||||
|
||||
|
|
|
|||
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
|
||||
Loading…
Reference in New Issue
Block a user