Comparing a Number to a String
Posted: Tue Apr 26, 2016 3:44 am
So, I have a "string" that is always a number (a page number), and sometimes when I try to reference it, everything goes smoothly, other times I get an error for comparing a string to a number.
This works:
But this returns an error for comparing a string to a number
If I try to do some math before I compare in the second example (by adding 0 or multiply by 1), then it doesn't error. BUT, the number I get is not accurate. It goes from 2 to 91, 891, 8891, etc. A qucik check for LUA says that comparing a string to a number is fine (assuming that the string is really a number). I'm at a loss.
This works:
Code: Select all
local page = selectionFrame.pageNumber.caption
if (#global.avatars > page*10) then
updateGUI(player, page+1)
end
Code: Select all
local page = selectionFrame.pageNumber.caption
if (page > 1) then
updateGUI(player, page-1)
end