thehankinator Posted May 25, 2015 Posted May 25, 2015 I've got the below code: local t = {} local e = {} local i = 100 e.val = i table.insert(t, e) for k,v in pairs(t) do System:Print(tostring(v.val == i)) if v.type ~= i then System:Print("false") end end The output is: true false I wouldn't have thought that I'd see the "false" print after a "true". Any idea what I am missing? It's got to be something simple... Quote
Rick Posted May 25, 2015 Posted May 25, 2015 Where is .type coming from? My guess is that's nil and so a nil would be not equal to 100 so it would print false. I think you mean: if v.val ~= i then 1 Quote
thehankinator Posted May 25, 2015 Author Posted May 25, 2015 That's exactly it, thanks. Stupid copy paste. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.