KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 14 Jan 2017 08:04 PM |
local BadDots = {} for i = 0,ExpectedDots,DotsX do table.insert(BadDots,"Dot"..i) BadDots["Dot"..i] = true end for i = 1,#BadDots do print(BadDots[i]) end
Why doesn't it print true? |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2017 08:20 PM |
Because BadDots is empty, and because you are using string keys and trying to read them like an index.
|
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 15 Jan 2017 07:05 AM |
The output prints:
Dot0 Dot4 Dot8 ...
So how would I make it print true? |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2017 07:07 AM |
Is what you are inserting into the BadDots table an instance or a script declared value?
|
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
|
| 15 Jan 2017 07:11 AM |
xdd
You can't set a string to a boolean value, it'll set it to true as in it isn't nil
|
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 15 Jan 2017 07:13 AM |
That still does not help me. So here's my first response:
So how would I make it print true? |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2017 07:16 AM |
If you want it to just print true then #code BadDots["Dod" .. i] = "true"
But if you want the value stored to = true then the values must be initialized as a boolean
|
|
|
| Report Abuse |
|
|
| |
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 15 Jan 2017 08:22 AM |
for _,dot in pairs(BadDots) do print(dot) -- true or false end |
|
|
| Report Abuse |
|
|