Jump to content

XML to table


Jusonex

Recommended Posts

Hey guys,

I am scripting at the moment on a new freeroam script and I want to create a gui gridlist with all the vehicles. But my problem is xml.

This is my code: (vehicles.xml is from freeroam)

  
function xmlToTable() 
    local root = xmlLoadFile("vehicles.xml") 
    local groups = xmlNodeGetChildren(root) 
    local vehicles = {} 
    for i, node in ipairs(groups) do 
        vehicles[xmlNodeGetName(node)] = xmlNodeGetAttribute(node, "id") 
    end 
end 
  

I want to have a table like for example this

vehicles["Helicopters"] = {548, 425, 417, 487, 488, 497, 563, 447, 469}

why doesn't it work?

Justus

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...