Variable, or no Variable?

-- Not sure how to title this topic

local sin = math.sin -- the 'sine' function in a variable

sin(tick()) -- using variable
math.sin(tick()) -- without variable

What would be best to use?

3 Likes

You could use either. But I will say that you shouldn’t use tick(), devs are trying to deprecate it do to it only displaying the local time. Use os.time() instead.

Yeah, I know, but this is just an example, Im just wondering what would basically be better to use, even if it is personal preference, because who knows it may be faster, or it may be wrong.

I am tired of these topics in which they ask short and silly things, as the user RoninTurtles said, it is practically deprecated and it is not so useful to use. It also depends a lot on the code you do, if your code would require a lot of that function, it is better to do it in a variable or otherwise you will see

2 Likes

Roblox said themselves that os.time is more efficient than tick() as in, they do not recommend using it

I just tried using both of them and they don’t seem to make a difference, they both ran at the exact same time

Luau has FastCall optimizations which make these micro-optimizations obsolete.

4 Likes

Please read my reply before you even respond.

1 Like

Not trying to start anything but, why post it then? It can’t be personal preference if Roblox literally said os.time is way more efficient and should be used over tick()

You are not even reading what im asking about.

1 Like

Thank you.

Well, I’m not responding to what your topic is about I’m responding to what you said about what Ronin said. But its whatever topic is solved shouldn’t matter anymore.

Please if you want to say something like this then do it in Messages

Also what’s wrong for having an example and having it being a bad practice if it’s not for anyone?
Just like if I say:
Basically I would like to know what this does:

while wait() do

I also know wait shouldn’t be sued, but it’s just an example

2 Likes

Why are you still going? and there’s nothing wrong with while wait() do
its just a shortened version of while true do wait() end lol

Yes but you should be using task.wait() instead of wait()

There is literally no difference whatsoever.

task.wait() is faster, more optimized than wait(), wait() is slower,

so that isnt true.

Also, please send a Personal Message instead of Replying to Threads.

Didn’t know that, thanks for letting me know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.