Jump to content

What's the problem Here?


Recommended Posts

function SetTime() 
    local mapMeta = xmlLoadFile("meta.xml") 
           local value = xmlNodeGetAttribute(mapMeta, "value") 
             local dotPos = string.find(value,":")-- The Problem 
               local hours = string.sub(value,1,dotPos-1) 
              local minutes = string.sub(value,dotPos+1,string.len(value)) 
             setTime(tonumber(hours),tonumber(minutes)) 
                 setMinuteDuration(1000000000) 
         outputChatBox("Time Setted") 
end 

Error : bad argument #1 to 'find' string expected got boolean

Edited by Guest
Link to comment

I tried with this script too :

local file = xmlLoadFile("meta.xml") 
        for i, v in ipairs(xmlNodeGetChildren(file)) do 
            local name = xmlNodeGetName(v) 
            if name == "settings" then 
                local sname = xmlNodeGetAttribute(v,"name") 
if sname == "#time" then 
                    local value = xmlNodeGetAttribute(v, "value") 
                    if value then 
                        value = string.gsub(value, "%s+", "") 
                        value = string.gsub(value, "[%[%]]", "") 
                        setTime(value:match('(%d+)%d+)')) 
                        realtime = value 
                    else 
                        setTime(12,0) 
                    end 
             end 
     end 
end 

but still doesn't set the correct time

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