How to use integers in Defold

#1

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

#2

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

local v = 1
v = v + 1

2 Likes

#3

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

1 Like

#4

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

0 Likes

#5

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

2 Likes