Like I see people writing.
Debounce = false
Debounce = true
OR
Debounce = 0
Debounce = 1
But is there a difference to it?
Like I see people writing.
Debounce = false
Debounce = true
OR
Debounce = 0
Debounce = 1
But is there a difference to it?
In most other programming languages 0 is false, and any other number is true(by default people use 1); however, in lua
only true is true
and
false or nil is false.
debounce is usually a variable type called a boolean, being true or false. These values are used in expressions such as if statements.
https://roblox.fandom.com/wiki/Boolean
within this article, the second sentence explains that LUA interpreters 0 as true, so using numbers as debounce variables I believe is not correct. Since debounce is usually used to prohibit re-access to a block of code.
if you were to use numbers for debounce then you would have to do something like
if debounce ~= 0 then
print("true")
else
print("false")
instead of
if debounce then
print("true")
else
print("false)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Thank you.