No obtengo los resultados esperados.

Dudas sobre el foro o cuestiones generales que no tengan cabida en otro foro.
Los resultados de edad son: 2,3,4,5 ... 1000 es mayor.
1, 0, -1, -2, -3 ... -1000 es menos.


Imagen
https://ibb.co/0jcJwNT

Imagen
https://imgur.com/FWEzeMQ





Empiezo a aprender y sigo el libro:

Imagen
https://ibb.co/HXL9t1y
HIDE: ON
Hidebb Message Hidden Description
Tu problema es que te esta fallando la teoría detrás del código. Tienes problemas con los tipos de datos de Lua, mira aquí http://www.w3big.com/lua/lua-data-types.html
name = Input.GetText('input-1');
age = Input.GetText('input-2');
ageNumber = tonumber(age);

if (age >= 18) then
    Input.SetText('input-3', name .. ' is of legal age.');
else
    Input.SetText('input-3', name .. ' is not of legal age.');
end
usamakey escribió:
05 Abr 2021 01:22
HIDE: ON
Hidebb Message Hidden Description
Gracias ahora aprendí cómo convertir una string en un número int en lua.
Dow Sher escribió:
05 Abr 2021 01:27
Tu problema es que te esta fallando la teoría detrás del código. Tienes problemas con los tipos de datos de Lua, mira aquí http://www.w3big.com/lua/lua-data-types.html
name = Input.GetText('input-1');
age = Input.GetText('input-2');
ageNumber = tonumber(age);

if (age >= 18) then
    Input.SetText('input-3', name .. ' is of legal age.');
else
    Input.SetText('input-3', name .. ' is not of legal age.');
end
Gracias. en el libro no enseña cómo convertir una string en un número int. Pero ahora aprendí. ¡Muchas gracias!