ULX

Author Topic: calling functions with a value- with out using timers  (Read 1776 times)

0 Members and 1 Guest are viewing this topic.

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
calling functions with a value- with out using timers
« 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
« Last Edit: April 09, 2013, 09:01:30 AM by nathan736 »
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: calling functions with a value- with out using timers
« Reply #1 on: April 08, 2013, 09:35:37 AM »
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.
Experiencing God's grace one day at a time.

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
Re: calling functions with a value- with out using timers
« Reply #2 on: April 09, 2013, 07:29:10 AM »
was wondering if this is even posable if useful.
Code: [Select]
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
« Last Edit: April 09, 2013, 08:58:16 AM by nathan736 »
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."