Jump to content

Random XML's marker


Recommended Posts

XML:

<zaladunki> 
    <marker x="-1707.185546875" y="12.604281425476" z="3.5546875" type="cylinder" size="3" r="255" g="255" b="255" a="170" /> 
    <marker x="158.99987792969" y="-22.182670593262" z=" 1.578125" type="cylinder" size="3" r="255" g="255" b="255" a="170" /> 
</zaladunki> 

How can i get random marker from this?

Link to comment

I have this:

function randomMarker () 
    local markers = xmlLoadFile("zaladunki.xml") 
    if markers then 
        local childs = xmlNodeGetChildren(markers) 
        for k,v in ipairs (childs) do 
            -- what shud i put here? 
        end 
    end 
end 

Link to comment
function randomMarker ( ) 
    local markers = xmlLoadFile ( "zaladunki.xml" ) 
    if ( markers ) then 
        local childs = xmlNodeGetChildren ( markers ) 
        local randomIndex = math.random ( #childs ) 
        local child = childs [ randomIndex ] 
        if ( child ) then 
            -- Do something 
        end 
    end 
end 

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...