skinlist: Allow textures containing '-' characters

Fixes issue #110
Thanks to Bastrabun for the code suggestion
This commit is contained in:
SmallJoker
2024-09-28 11:10:44 +02:00
parent df62f2042d
commit 3cf80c9272
3 changed files with 6 additions and 4 deletions

View File

@ -9,12 +9,14 @@ local function run_unittest()
-- -----
-- `.`: Simple register + retrieve operations
skins.register_skin(PATH, "player.DotSep.png")
skins.register_skin(PATH, "player._DotSep_666_.1.png")
assert(skins.register_skin(PATH, "player.DotSep.png"))
assert(skins.register_skin(PATH, "player._DotSep_666_.1.png"))
assert(skins.register_skin(PATH, "character._DotSep_With-Dash-.png"))
assert(get_skin("player.DotSep"))
assert(get_skin("player._DotSep_666_.1"))
assert(get_skin("player.DotSep.1") == nil)
assert(get_skin("character._DotSep_With-Dash-"))
-- -----
-- Ambiguous skin names (filenames without extension). Register + retrieve
@ -42,7 +44,6 @@ local function run_unittest()
assert(get_skin("player_Com_Pat_42") == "player._Com_Pat_42")
assert(get_skin("player_Com_Pat_42_1") == "player._Com_Pat_42.1")
error("Unittest passed! Please disable them now.")
end