Ulysses
General => Developers Corner => Topic started by: nathan736 on April 08, 2013, 09:03:38 AM
-
ignore the empty table strings what im wondering is if its posable to call a function based on the panels url with out doing additional logic tests beyond the for loop which gets broken when it finds the correct one.
\/\/ bad code was here now gone
-
You're going to have to describe the problem better if you want help. Your explanation and code are all over the place as it stands.
-
was wondering if this is even posable if useful.
timertable ={}
-- do the bellow code for every situation you want to detect
timertable[1] = "on pg1"
timer.Create("phone pg1",0,1, function() (print "phone pg1 timer called or started and we did something ?") end)
timer.stop("phone pg1") -- stopped the timer because we don't want to run it when we make it
--do the above code for every situation you want to detect and do something about it
function timers(situation) -- opens the function because we want to be able to call this level 1
if oldsituation = situation then return end -- we don't want the same solution so exit ps could cause problems on redundant calls
for k,v in pairs(timertable) do -- pulls up the timer table level 2
if situation = timertables[v] then -- checks of the situation we are in is the solution that we are checking level 3
timer.Start(situation) -- starts the solution
oldsituation = situation -- prevents us from doing the solution again with out finding another solution first
break -- we found a solution stop
end --level 3
end --level 2
end -- exit function level 1