idlehands
New Coder
Hi All,
I am studying LUA scripting and came across a string of codes that I can't understand. Was hoping anyone here can help me understand this:
local B = C - D
B = B < -1 and -1 or 1 or B
B = math.floor(B * 1000) / 1000
B = B + 0.3 * (1 - math.sin(B * 3.14 / 2)) + 0.2
The line I am unable to understand is this:
B = B < -1 and -1 or 1 or B
What does this mean?
Is it defining the value of B?
Thanks a lot for the help!
I am studying LUA scripting and came across a string of codes that I can't understand. Was hoping anyone here can help me understand this:
local B = C - D
B = B < -1 and -1 or 1 or B
B = math.floor(B * 1000) / 1000
B = B + 0.3 * (1 - math.sin(B * 3.14 / 2)) + 0.2
The line I am unable to understand is this:
B = B < -1 and -1 or 1 or B
What does this mean?
Is it defining the value of B?
Thanks a lot for the help!