file read/write question

Hi,

I write out an integer to a file like this:

local halfSpeed = 3
file:write( tostring( halfSpeed ), “\n” )

Later I read it in:

halfSpeed = file:read()
print("halfSpeed = ",halfSpeed) – it prints out 3
if halfSpeed == 3 then
print(“got to here”) – this fails
end
halfSpeed = math.floor( halfSpeed )
if halfSpeed == 3 then
print(“got to here”) – this works
end

It appears that Lua thinks it read in a floating point value?
Am I missing something?
Thanks all,
-Dennis [import]uid: 108253 topic_id: 20068 reply_id: 320068[/import]