Diogo FIh Posted March 6, 2022 Share Posted March 6, 2022 (edited) Existe alguma funcao para forcar um calculo neste estilo ? local teste = "123+44/22-33" iprint(tonumber(teste)) Edited March 6, 2022 by Diogo FIh Link to comment
Forum Administrators Tut Posted March 6, 2022 Forum Administrators Share Posted March 6, 2022 Moving this into the Portuguese scripting section. 1 Link to comment
Diogo FIh Posted March 6, 2022 Author Share Posted March 6, 2022 22 minutes ago, Tut said: Moving this into the Portuguese scripting section. como faço isso? Link to comment
KronoS Lettify Posted March 7, 2022 Share Posted March 7, 2022 On 06/03/2022 at 11:54, Diogo FIh said: Existe alguma funcao para forcar um calculo neste estilo ? local teste = "123+44/22-33" iprint(tonumber(teste)) Você pode utilizar o loadstring de Lua para isso. Veja o seguinte exemplo: local teste = "123+44/22-33" local final = loadstring('return '..teste)() print(final) --output: 92 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now