schedule.Add

From GMod Wiki

Revision as of 10:44, 4 October 2009 by Dlaor (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax schedule.Add( String name, Function func, Number sec, Number min, Number hour, String wday, Number day, Number month, Number year )
Where is this used?
Description:
Setup and start a schedule by name.
Returns: nil
Part of Library: schedule
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Schedule.Add]Schedule.Add [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionCreates a schedule that runs every Monday morning at 10:30am. Also demonstrates one method of passing parameters to scheduled functions.
Used onNewerShared.png
Code
 
local function otherFunc(name)
 Msg("Hello " .. name .. ", it's 10:30am on Monday!")
end
 
local i = 1
local function someFunc()
   //selection logic is done here so we can decide what parameters to pass to the real function.
   if (i == 1) then
      otherFunc("John")
   else
      otherFunc("Bob")
   end
end
 
schedule.Add("MySchedule", someFunc, 00, 30, 10, "Monday", nil, nil, nil)
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox