denny199 Posted October 27, 2012 Posted October 27, 2012 Hai there, I'm working on a new script with xml, but now I've got some problems, the saving is working fine, but the exporting isn't so good. How could I get the text after NAAM_ so only this: NAAM_Danny or NAAM_Danny3 or NAAM_path and so on. So only after the underscore, underscore = _ . Here's my xml. <radio> <NAAM_Danny naamradio="Danny" posx="232.17012023926" posy="-1205.9498291016" posz="75.3125" distance="5"></NAAM_Danny> <NAAM_Danny3 naamradio="Danny3" posx="238.56645202637" posy="-1206.4357910156" posz="75.3125" distance="6"></NAAM_Danny3> <NAAM_path naamradio="path" posx="239.8809967041" posy="-1195.0231933594" posz="75.34440612793" distance="44"></NAAM_path> </radio> I've no idea how to start. Regards, Danny Sometimes I dream about cheese
Anderl Posted October 27, 2012 Posted October 27, 2012 I don't get it, why do you need to get the text after _? Don't you just want to get attributes from the nodes? If you want this, use xmlNodeGetAttributes. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
denny199 Posted October 27, 2012 Author Posted October 27, 2012 well, then I don't know a another way for the saving system then Sometimes I dream about cheese
Castillo Posted October 27, 2012 Posted October 27, 2012 local radioFile = xmlLoadFile ( "radio.xml" ) if ( radioFile ) then for _, path in ipairs ( xmlNodeGetChildren ( radioFile ) ) do local name = xmlNodeGetName ( path ):gsub ( "NAAM_", "" ) outputChatBox ( name ) end end That should do it if I'm right. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
denny199 Posted October 27, 2012 Author Posted October 27, 2012 Thank you, I'm understanding this xml scripting now Sometimes I dream about cheese
Castillo Posted October 27, 2012 Posted October 27, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now