3 ms·
Wdym Lua has no floats? Lua defaults to doubles (big floats) not integers.
by melony 4y ago
Wdym Lua has no floats? Lua defaults to doubles (big floats) not integers.
- LeifCarrotson 4y agoAs of Lua 5.3 (from 2015), Lua has both doubles and integers. The famous book "Programming in Lua", still often used and quoted, did apply to 5.2, which had only doubles.
- samatman 4y agoWorth adding that the only 5.1 anyone still uses (not you Warcraft), LuaJIT, has native support for C numeric types, including complex numbers. They can be referenced literally as 12LL, you can do arithmetic on them, but have to call `tonumber` to use them where Lua expects a 'number'.
- samatman 4y agoWhat I said is that Lua doesn't need floats. You can build Lua on a 32 bit chip which doesn't have a native float type, without floating point support. Which is handy.