FBA The Creator
http://www.fbacreator.com/fbaforum/

Number to String Coercion
http://www.fbacreator.com/fbaforum/viewtopic.php?f=5&t=56
Page 1 of 1

Author:  phrebh [ Fri Jun 20, 2008 1:47 pm ]
Post subject:  Number to String Coercion

The help says, "Conversely, whenever a number is used where a string is expected, the number is converted to a string, in a reasonable format." However, I've found that to not always be the case when using the string functions.

For example, this:
Code:
temp=1234
test=temp.byte(3)
debug(test)

function onmainloop()
end
gives you an error: "attempt to index global 'temp' (a number value)".

Which is right? Should I be able to use the string functions on a number, or should I need to convert a number to string first?

For now I will do what works. Thanks!

Author:  umbiomar [ Fri Jun 20, 2008 3:24 pm ]
Post subject:  Re: Number to String Coercion

weird behaviour! it works if you "force" coercion using string concatenation operator

Code:
temp=1234
test=""..temp 
test=test.byte(3)
debug(test)


the same behaviour shows the win32 version as the picture shows

Attachment:
bug.JPG
bug.JPG [ 25.68 KiB | Viewed 6761 times ]


I suppose this bug belongs to the lua library, so the better place to post this bug is to lua support team.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/