generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: ROBLOX's tonumber()

Previous Thread :: Next Thread 
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
09 Nov 2013 08:38 AM
print(tonumber([[0.2]])
> 0.2
print(tonumber([[0,2]])
> nil

Is this just ROBLOX failing or does this have a reason?
Report Abuse
OneTrueGodTheHolyCow is not online. OneTrueGodTheHolyCow
Joined: 24 Oct 2013
Total Posts: 9350
09 Nov 2013 08:40 AM
0,2 is not a number.
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
09 Nov 2013 08:41 AM
Not in Lua, but when I write numbers down. I use a comma to indicate the decimals.
They should be using both in my opinion.
Report Abuse
bohdan77 is not online. bohdan77
Joined: 10 Aug 2008
Total Posts: 7944
09 Nov 2013 08:43 AM
So, 5,000,000,000 = 5,000,000.000.
Report Abuse
OneTrueGodTheHolyCow is not online. OneTrueGodTheHolyCow
Joined: 24 Oct 2013
Total Posts: 9350
09 Nov 2013 08:45 AM
You would use a , to indicate a list of numbers...or in tables

a, b = 1, 2
ab = {1, 2}

And most people use a dot as decimal place, as far as I know only Spanish people use a , (I'm in Spain)
Report Abuse
OneTrueGodTheHolyCow is not online. OneTrueGodTheHolyCow
Joined: 24 Oct 2013
Total Posts: 9350
09 Nov 2013 08:46 AM
@bohdan,

Nah, people who use a comma switch , and . they don't just use ,
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
09 Nov 2013 08:47 AM
Stop right there.

In Europe, and probably somewhere else (maybe only the country I live in and OP lives in), commas are used instead of . to indicate where we go from whole numbers to decimals.

0,2 would be 0.2 in US.

And 5.000.000 would be 5,000,000 in US.

Pretty weird and leads to communication problems, but yesh, that's how it is.


So in some ways, it would be good to have that upgrade of tonumber, but I think it needs an argument to determine whatever , is for decimals or large numbers and vice versa with .

- As, in ROBLOX Studio 2013, when you change a number property manually, the rule above is active too! What?!?!?!?!
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
09 Nov 2013 08:48 AM
Roblox is an American company; as such it does not make sense that they should use a primarily European method of recording numbers. Using both 0,2 and 0.2 to mean 2/10 could cause a great many problems. Indeed, far more problems than using two systems would fix.

-God Bless-
Report Abuse
bohdan77 is not online. bohdan77
Joined: 10 Aug 2008
Total Posts: 7944
09 Nov 2013 08:52 AM
Ah, excuse my ignorance please.

But, yes. Roblox is a American Company. But from their motives and attempts to support different languages. This may as well be a consideration.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
09 Nov 2013 08:55 AM
This isn't a problem with Roblox. This is to do with Lua itself, and isn't a problem. Most, if not all programming languages are like this. Using a , as a decimal point would completely through the parser. What would this do:
x, y = 0,2
Would it do this: x = 0; y = 2;
Or: x = 0.2; y = nil;
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
09 Nov 2013 08:57 AM
As8D is right, I'm European, and as someone else said this is an American company.
I'm just wondering why Roblox had chosen for that.

I'd say:
Five milion: 5.000.000
Two and a half: 2,5
Two and a half milion: 2.5 mil / 2.500.000
Two milion, five hundred, twenty-five and one third: 2.000.525,3

It's just the way you do it.
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
09 Nov 2013 08:59 AM
This would be my rendition:


local function GetNumber(String)
local NewString = String
for Number = 1,NewString:len() do
if NewString:sub(Number, Number) == [[,]] then
NewString = NewString:sub(1,Number - 1) .. [[.]] .. NewString:sub(Number + 1)
end
wait()
end
return tonumber(NewString)
end
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
09 Nov 2013 10:30 AM
in finland 1,500,000 is just 1 500 000.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
09 Nov 2013 10:36 AM
"," is ugly.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
09 Nov 2013 12:27 PM
If you really need this, then just change some things around. Write your own tonumber.

while obamacare() do benefitMiddleClass() end --LuaWeaver
Report Abuse
Whatnow303 is not online. Whatnow303
Joined: 15 Sep 2009
Total Posts: 95
09 Nov 2013 03:36 PM
while obamacare() do chargePeopleforHealthcaretheydontNeed() end --whatnow303
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
09 Nov 2013 03:44 PM
1000000 is one million
1,000,000 is one million
1,000.000 is one thousand
1.000.000 does not mean something
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
09 Nov 2013 05:16 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2013 05:16 PM
^ YOU NOOB HELP ME
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
09 Nov 2013 05:21 PM
192.168.0.1
Report Abuse
chickenman158 is not online. chickenman158
Joined: 18 Jan 2011
Total Posts: 915
09 Nov 2013 09:20 PM
"When they traced the killer's IP address, it was from the 192.168/16 block. Just kidding, it was from the 10/8 block."
Report Abuse
uyjulian is not online. uyjulian
Joined: 29 Nov 2012
Total Posts: 1214
09 Nov 2013 10:32 PM
numbers and internationsasals pl0x

1000000 is easy to read
1,000,000 1.000.000 complicated pl0x
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
09 Nov 2013 10:43 PM
"one million"
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Nov 2013 12:58 PM
When they traced the killer's IP address, it was 127.0.0.1 - not whatever.

Idiots.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2013 01:02 PM
hehehehe it was 513ND3R
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image