love.filesystem.deltree
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Centauri Soldier
- Prole
- Posts: 42
- Joined: Mon May 21, 2012 6:38 am
Re: love.filesystem.deltree
Hey, just wanted to stop by and say thanks, Roland_Yonaba. String manipulation has always been my weakness in lua. I have read tutorials, seen examples and still it gave me trouble. But after seeing your example, I spent a few hours buried in my hard copy of the Lua Reference Manual and playing with code and now I think I've got it. Your example triggered something in my brain that no other example has so I wanted to say 'Thanks'...so thanks !
- Centauri Soldier
- Prole
- Posts: 42
- Joined: Mon May 21, 2012 6:38 am
Re: love.filesystem.deltree
This version will account for underscores in the file name and extension.
Code: Select all
function love.filesystem.getFileType(sFile)
local sRet = "";
local sFileRev = string.reverse(sFile);
local nPoint = string.find(sFileRev, "[.%..]");
if nPoint then
sRet = string.sub(sFile, string.len(sFile) - nPoint + 1);
end
return sRet
end
Who is online
Users browsing this forum: Bing [Bot] and 89 guests