Skip to content

Commit d8ae07e

Browse files
committed
wait,tableExtension
1 parent 3ce8e4b commit d8ae07e

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

Scripts/__methods.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,23 @@ RunLater {
3232
"c",
3333
time = 2
3434
}
35+
36+
--wait함수
37+
function wait(time)
38+
local callTime = os.clock() + (time / 1000)
39+
repeat
40+
until os.clock() > callTime
41+
end
42+
43+
--table메소드 익스텐션
44+
function table.print(t)
45+
if not t then
46+
return false
47+
end
48+
49+
print("Table = \n{")
50+
for k, v in pairs(t) do
51+
print(string.format("\t%s = %s%s", k, v, (k == #t and "") or ","))
52+
end
53+
print("}")
54+
end

ServerScripts/__methods.lua

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RunLater = function(obj)
1414
parameters[i - 1] = obj[i]
1515
end
1616

17-
Client.RunLater(
17+
Server.RunLater(
1818
function()
1919
_func(table.unpack(parameters))
2020
end,
@@ -32,3 +32,23 @@ RunLater {
3232
"c",
3333
time = 2
3434
}
35+
36+
--wait함수
37+
function wait(time)
38+
local callTime = os.clock() + (time / 1000)
39+
repeat
40+
until os.clock() > callTime
41+
end
42+
43+
--table메소드 익스텐션
44+
function table.print(t)
45+
if not t then
46+
return false
47+
end
48+
49+
print("Table = \n{")
50+
for k, v in pairs(t) do
51+
print(string.format("\t%s = %s%s", k, v, (k == #t and "") or ","))
52+
end
53+
print("}")
54+
end

0 commit comments

Comments
 (0)