Jump to content

Help with xml and function


rE5vK8bu

Recommended Posts

warn.xml:

    string = "Wait... Press '%s' (you must not move!)"/> 

function:

function getStringFromID(text) 
    if type(strings)~= "table" then 
        local file = xmlLoadFile("warn.xml") 
        strings = {} 
        if file then 
            for _,v in ipairs(xmlNodeGetChildren(file))do 
                strings[xmlNodeGetName(v)] = xmlNodeGetAttribute(v,"string") 
            end 
            xmlUnloadFile(file) 
        end 
    end 
    return strings[tostring(text)] or "" 
end 
  
--getStringFromID("wait_for_move") 
--return "Wait... Press '..key..' (you must not move!)" 

How i get string id from value xml?

Example:

    string = "y"/> 

I want get x from y

How i do to get x?

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