Here's a link to my recursive table.tostring function. It handles everything except userdata.
https://github.com/CentauriSoldier/Open ... /table.lua
Search found 42 matches
- Mon Sep 23, 2013 6:24 am
- Forum: Support and Development
- Topic: save lua-table to lua-script
- Replies: 18
- Views: 7941
- Sat Jun 09, 2012 3:28 am
- Forum: Support and Development
- Topic: XML in Love
- Replies: 4
- Views: 3253
Re: XML in Love
Well, as much as I love pure lua and despite the fact that my entire current project and all of its modules are using lua tables to store data, I still find a need from time to time to use xml. I just wondered if it had been considered and after viewing your answers I can see your logic regarding th...
- Fri Jun 08, 2012 10:21 pm
- Forum: Support and Development
- Topic: XML in Love
- Replies: 4
- Views: 3253
- Fri Jun 08, 2012 5:50 pm
- Forum: Support and Development
- Topic: Decoding error: Invalid UTF-8 [SOLVED]
- Replies: 2
- Views: 6226
Re: Decoding error: Invalid UTF-8 [SOLVED]
And within 5 minutes of posting this I stumbled onto the solution (facepalm). To all future developers: I am using Notepad++ to write lua and my encoding was set to ANSI. Changing it to Encode in UTF-8 without BOM allowed the offending code block to work. The encoding UTF-8 without BOM does not wor...
- Fri May 25, 2012 6:14 am
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
Re: love.filesystem.deltree
This version will account for underscores in the file name and extension. 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)...
- Fri May 25, 2012 4:48 am
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
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...
- Thu May 24, 2012 7:05 pm
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
Re: love.filesystem.deltree
Oh, I see. I most definitely will try it then, thank you. Here's another one for creating a delimited table from a string. function string.totable(sString, sDelimiter) if type(sString) == "string" and type(sDelimiter) == "string" then if sString ~= "" and sDelimiter ~= ...
- Thu May 24, 2012 6:27 pm
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
Re: love.filesystem.deltree
That will find the first occurance of ".". If you look at my code, you'll see that mine searches starting from the end of the string. If a person simply does pattern matching then getFiletype for "myfile.something.ext" will return ".something" or ".something.ext&qu...
- Thu May 24, 2012 4:03 pm
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
Re: love.filesystem.deltree
Glad you see it my way :ultraglee: . I hope folks get some use out of it. Here's another little snippet for getting file type. This will return the "." but you can adjust it to not do so if you please. function love.filesystem.getFiletype(sFile) local sRet = ""; if love.filesyste...
- Thu May 24, 2012 12:25 am
- Forum: Support and Development
- Topic: love.filesystem.deltree
- Replies: 11
- Views: 3795
Re: love.filesystem.deltree
The remove function won't delete a folder with things inside.