generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Table help

Previous Thread :: Next Thread 
KingJacko is not online. 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
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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 is not online. 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
TextSoaked is not online. TextSoaked
Joined: 04 Sep 2015
Total Posts: 1040
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 is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
15 Jan 2017 07:09 AM
I am inserting a string.
Report Abuse
TextSoaked is not online. TextSoaked
Joined: 04 Sep 2015
Total Posts: 1040
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 is not online. 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
TextSoaked is not online. TextSoaked
Joined: 04 Sep 2015
Total Posts: 1040
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
TextSoaked is not online. TextSoaked
Joined: 04 Sep 2015
Total Posts: 1040
15 Jan 2017 07:16 AM
Dot* not Dod my b lol


Report Abuse
TaaRt is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image