forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lua Table to XML (and Back)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Fri Jan 13, 2006 10:12 pm    Post subject: Lua Table to XML (and Back) Reply with quote

Hi Folks,

I am finally reading the Lua tutorials and noticed something. The Lua tables, how they can be nested, lend themselves perfectly to saving them as an xml file. When I imagine that I could save a lua table to xml, or read an xml file from the internet and access it as a nested lua table, I get all warm inside.

I'm not talking about the whole namespace, document template and so on, that would be more suitable for a full-fledged xml module. I would even ignore attributes. Perhaps only support CDATA sections (the <![CDATA[some text with annoying characters reserved for xml formatting]]> bit).

But the table structure and flexibility just really lends itself so well for it! It could be linked to database access and what not - I could just write an http request to an asp or php page, and get an xml string back that reads into a (nested) Lua table. I could save my tables holding my configuration and settings with one command to xml files on the memory stick.

All it would need is a save lua table command. Of course I could just write one in Lua, but this would serve such basic needs, I think nearly every single program could (and would) use it. Even those who don't care about xml will appreciate being able to save and load a(n optionally nested) table like that.

Or am I wrong?

(goes back to reading)
Back to top
View user's profile Send private message
liquid8d



Joined: 30 Jun 2005
Posts: 66

PostPosted: Sat Jan 14, 2006 4:15 am    Post subject: Reply with quote

I am using tables write now to download ini-style files and read them right into a lua table... it works extremely well :) Its nice to just read in the key/value items for things, and they can be easily accessed.

[Name]
Desc=nifty stuff
Whatever=275

item[x].Name
item[x].Desc
item[x].Whatever

Certainly a nested table would be useful for xml. It's why I am suprised that we haven't had a working rss reader in lua yet... still waiting :P

liquid8d
Back to top
View user's profile Send private message AIM Address
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Sun Jan 15, 2006 4:05 am    Post subject: Reply with quote

Hmm... What does pspRSS do then?
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Jan 15, 2006 4:22 am    Post subject: Re: Lua Table to XML (and Back) Reply with quote

Arwin wrote:
All it would need is a save lua table command. Of course I could just write one in Lua, but this would serve such basic needs, I think nearly every single program could (and would) use it. Even those who don't care about xml will appreciate being able to save and load a(n optionally nested) table like that.

Or am I wrong?


Why everyone wants XML? For Lua in my opinon it is much easier to save nested tables in Lua source format and just execute the file when loading it :-)
Back to top
View user's profile Send private message
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Sun Jan 15, 2006 10:35 am    Post subject: Re: Lua Table to XML (and Back) Reply with quote

Shine wrote:
Arwin wrote:
All it would need is a save lua table command. Of course I could just write one in Lua, but this would serve such basic needs, I think nearly every single program could (and would) use it. Even those who don't care about xml will appreciate being able to save and load a(n optionally nested) table like that.

Or am I wrong?


Why everyone wants XML? For Lua in my opinon it is much easier to save nested tables in Lua source format and just execute the file when loading it :-)


Because XML is a widely used standard. Sure, using Lua source format works, but I have been using XML for this kind of thing in several languages for five years now, and others are picking it up also. I could just save some data from a database, and Lua could pick it up as a table and use it. Simple as that. And the other way around. Just one of many examples.

You may find it trivial, probably from not using XML for anything at the moment. But supporting XML like that would not be less trivial than supporting PNG files. They are both widely accepted standards, one for graphics, the other for data.
Back to top
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Sun Jan 15, 2006 8:41 pm    Post subject: Reply with quote

possibly this might help:
LUA to XML parser

greets
lumo
PS: might be another nice 'plugin' for luaplayer
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
modsyn



Joined: 27 Sep 2005
Posts: 28

PostPosted: Tue Jan 17, 2006 8:07 am    Post subject: Reply with quote

i would love an XML/html to table function.
or at least the ability to drop in plugins. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group