How to use integers in Defold

Hi,

I want to work with integers but I don’t know to do this in Defold.

How can I create an int?
How can I change the int?

1 Like

Lua doesn’t have an integer type.
Just avoid fractions and you still have integer math:

local v = 1
v = v + 1

2 Likes

Rationale https://www.lua.org/pil/2.3.html

1 Like

Lua which is a language used in Defold scripts has no integer type, only numeric type/ number (like double). Why do you specifically need integers?

You can check support for Haxe and Typescript in Defold

Lua 5.3 introduced a new integer type, but since Defold uses LuaJIT/5.1 there’s only the number type.

2 Likes