Timer:IsPastSimMS

From Data Realms Wiki

(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Beautifybot (talk) to last revision by DrLuke)
m (updating function page)
Line 1: Line 1:
{{LuaFunction
{{LuaFunction
-
|function_name       = Timer:IsPastSimMS
+
|function_name =IsPastSimMS
-
|arguments           = [[number]] Time in milliseconds
+
|arguments =* A unsigned long specifying the threshold amount of time in ms.
-
|returns             = [[nil]]
+
|returns =A bool only yielding true if the elapsed time is greater than the passed in value.
-
|description         = This function will check, whether a certain time has passed after the timer has been created.
+
|description =
-
|codedesc             = This will gib the object this script is attached to after 5 seconds have passed.
+
Returns true if the elapsed time is past a certain amount of time.
-
|code                 = <code lua n>
+
|codedesc = This will gib the object this script is attached to after 5 seconds have passed.
 +
|code = <code lua n>
function create(self)
function create(self)
     self.LTimer = Timer(); --this is needed for "Timer:IsPastSimMS" to work.
     self.LTimer = Timer(); --this is needed for "Timer:IsPastSimMS" to work.
Line 15: Line 16:
     end
     end
end</code>
end</code>
-
|output               = nil
+
|output = nil
-
|}}
+
}}

Revision as of 00:46, 28 June 2012

Function
SyntaxIsPastSimMS( * A unsigned long specifying the threshold amount of time in ms. )
Description:
Returns true if the elapsed time is past a certain amount of time.
ReturnsA bool only yielding true if the elapsed time is greater than the passed in value.




Example
DescriptionThis will gib the object this script is attached to after 5 seconds have passed.
Code
  1. function create(self)
  2.     self.LTimer = Timer(); --this is needed for "Timer:IsPastSimMS" to work.
  3. end
  4.  
  5. function update(self)
  6.     if Timer:IsPastSimMs(5000) == true then --checks if 5 seconds (5000 milliseconds) have passed
  7.         self:GibThis(); --if 5 seconds have passed, gib(kill) the object!
  8.     end
  9. end
Outputnil
Personal tools