Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currTime = os.clock()
- ... code to time ...
- local deltaT = os.clock() - currTime
- if deltaT > 0 then
- //discard the "0" times and you should see some times print to console... I think it's the game or lua (not so much the code) that's resulting in these barely noticable delays. Maybe this is not a useful means to determine what is optimal.
- Print(ToString(deltaTime))
- end
- //////////// I'm not sure why but Shared.GetTime() in place of os.clock() just gives me 0's
- But i did find an interesting way to about about doing this:
- function YourModClass:Update(deltaTime)
- end
- The deltaTime of your Update function can be used to time code.
- I suggest having a test-mod on hand for doing the following:
- function YourModClass:Update(deltaTime)
- for i = 1,1000 do
- SlowCode()
- end
- Print(deltaTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement