lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


so i've got this function here:

function HandTrackOSCHandler:GetArmIndex( id )
	local idx = -1
	local k,v
	for k,v in pairs(self.arms) do
		local arm_id = v:GetId()
		print("'"..arm_id.."'","'"..id.."'","'"..k.."'")
		if id==arm_id then
			print("found")
			idx = k
			break
		end
	end
	print("returning "..idx)
	return idx
end

i'm passing in a number i get from a substring pattern match.

when i run the code, having set up everything else all ok, the print statements give me:

'235'   '235'   '1'
returning -1

in other words, even though 235 quite clearly == 235, the code inside the if statement never executes!

why does 235 not equal 235? why isn't 235==235 true?

--
f r e y
live music with computers
http://www.frey.co.nz