LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.
public handler myHandler()
variable tNum as Number
variable tNumString as String
put 5 into tNum
format tNum as string
put the result into tNumString
log tNumString
end handler
The result is not 5 but 5.000000 even if the variable tNum is defined as an Integer.
public handler myHandler()
variable tLine as Integer
repeat with tLine from 1 up to 3
log tLine
end repeat
end handler
The result is:
1
2.000000
3.000000
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode Data Grid Helper - An intuitive interface for building LiveCode's Data Grids Excel Library- Extends the LiveCode language for controlling MS Excel
This is a known issue. For the time being, @LCMark gave me his handler to use when formatting a number as a string and you just want the integer representation.
handler FormatInt(in pNumber as Number) returns String
variable tNumberString as String
put pNumber formatted as string into tNumberString
if "." is in tNumberString then
variable tDotOffset
put the first offset of "." in tNumberString into tDotOffset
delete char tDotOffset to (the number of chars in tNumberString) of tNumberString
end if
return tNumberString
end handler
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode Data Grid Helper - An intuitive interface for building LiveCode's Data Grids Excel Library- Extends the LiveCode language for controlling MS Excel
trevordevore wrote:This is a known issue. For the time being, @LCMark gave me his handler to use when formatting a number as a string and you just want the integer representation.
That was me, but I'm flattered to be confused with @LCMark.
Unfortunately this has turned out to be an (even) more challenging fix that we expected, so I'm afraid it won't be fixed in 8.0.0-dp-2. Sorry.
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com