Notes:
- Only happens when using Lua 5.4
- Server artifact 4491 Windows
- Happens both client & server-side
- Happens on both Stable & Canary
Expected behavior:
For the Lua math library to accept vector types like with CfxLua 5.3. For example, I use math.floor
on vectors to round sometimes. This should run the floor operation on each vector value and return a vector.
Current behavior:
Using Lua math operations such as math.ceil
, math.floor
makes Lua throw a bad argument error. bad argument #1 to 'floor' (number expected, got vector)
.
Repro:
-- This will throw type errors when using 5.4 but works with CfxLua 5.3
local _vector = vec(2.95234, 1.234324, 1049.623425)
print(math.ceil(_vector))
print(math.floor(_vector))
print(math.abs(_vector))
Comments:
Not sure when the math library started doing this in 5.4. I know this worked fine ~3 or so months ago since I was using this to round player positions before saving them to db.
Guess it’s another thing I let slip through the cracks without reporting (Sorry).