-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods.lua
More file actions
35 lines (28 loc) · 951 Bytes
/
methods.lua
File metadata and controls
35 lines (28 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local methods = {}
-- Wait function. Waits a certain amount of seconds then does things
function methods.wait(number)
local currentTime = os.time() -- The time when the function was called
while true do
if math.floor(os.time() - currentTime) >= number then
-- The time between os.time() and the time the function was called equals the number
-- Break so that the user can do whatever is after the wait()
break
end
end
end
-- Tick function, returns os.time(). Thats is.
function methods.tick()
return os.time()
end
-- Assert function, returns an error message if the value passed is false or nil
function methods.assert(value, message)
if value == false or value == nil then
-- Send an error message
error(message, 1)
end
end
function methods.delay(number, func)
methods.wait(number)
func()
end
return methods