Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i test how long something takes?

Asked by
CjayPlyz 643 Moderation Voter
5 years ago

How do i test how long something takes?

like

for i = 1, 100, -1
    -- codes
end

print() -- prints how much long it took for i to finish
0
There’s a function called tick, which can do this User#19524 175 — 5y

1 answer

Log in to vote
3
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago

Check the difference in tick from before and after you run the loop:

local StartTick = tick()
for i = 1, 100, -1
    -- codes
end

print(tick() - StartTick) -- prints how much long it took for i to finish

I explain how this works better here.

0
thanks CjayPlyz 643 — 5y
Ad

Answer this question