function XMLtoTable(sString)
if( not sString ) then return ""; end
local s, e, sTag, sTemp = strfind(sString, "^<([^>]-)>(.*)$");
local sInner;
-- we have a tag
if(s) then
sString = sTemp;
local tTable = {};
while sTag do
s, e, sTag = strfind(sTag, "^(%S+)");
s, e, sInner, sString = strfind(sString, "^(.-)"..sTag..">(.*)$");
if( not tTable[sTag] ) then
tTable[sTag] = {};
end
tinsert(tTable[sTag], XMLtoTable(sInner));
s, e, sTag, sString = strfind(sString, "<([^>]-)>(.*)$");
end
return tTable;
-- we have data
else
return sString;
end
end
Very simple parser right now. I intend to make it better.
Used it to export YHub accounts to another hub soft. Probably has a million other uses.
-NotRabidWombat
make that billion of uses ... thanks for keeping it fresh NotRambitWombat ..
Cant wait to see what else u can do :)
I originally used Excel to convert my yhub accounts to Ptokax and I really wish I'd has this script then, it's much more elegant and would have saved me having to work with a 20MB spreadsheet 8o
Since I missed out on my chance to use it there, I'm going to make a (possibly foolhardy) attempt to use it to create a next gen nForce bot now that their scripts are XML. Probably just get it to generate a simple text file and use one of the timed message bots around to broadcast them although if I can get my head around the language enough (just learning), I'll try to make it into a full bot with commands etc.
I'll keep the board posted on any developments but if anyone's working on something similar, I'd love to hear how you're getting on.
hehe rabidwombat put another nail in yhub's coffin - very nice! heh heh sorry for this offtopic post but i really hate yhub! :evil:
wats the use of this script in brief ???
and how to use it ?