PDA

View Full Version : StrToInt


mitko
October 13th, 2002, 03:55 PM
I'm using the new LUA GVMS and wasn't able to convert a string to a integer/double.
I'm sure it can be done and I'm almost sure I've seen someone else to ask this question but wasn't able to find it in the forum

Can someone help me?
Can someone list all the additional functions in GVMS added to LUA by Girder?

mitko
October 13th, 2002, 03:55 PM
Update:
I found out that if a make an arithmetic operation with a string variable and an integer one I get an integer result.

tmpString = '101';
tmpInt = tmpString + 1;
=> tmpInt = 102

That's fine but if I need the exact same integer value do I have to do it +1 and then -1?
I doubt it!

vynce
October 13th, 2002, 03:55 PM
You can use the tonumber() function (do a search for it here for more details: Lua Reference Manual (http://www.lua.org/manual/manual.html)). You could also add zero or multiply by one.

mitko
October 13th, 2002, 03:55 PM
Thanks, Vynce, I used the tonumber() function and it works
:)