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
 

Detect if value=table?

Previous Thread :: Next Thread 
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
08 Feb 2016 08:29 AM
When I made a thing indexing tables, I made it run through
local d={"mip",{car,BrickColor.Blue},7}
Which didn't turn out so well (attempt to concatenate local 'Item' (a table value))
So I made a thing
if Item~=table then
(function)
else
print"no table-ception support"
end

Which returned the same error. Help?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 08:32 AM
The error is elsewhere. You don't concatenate anywhere here.
However, tables can't be compared like that as far as I know.
Report Abuse
mityguy is not online. mityguy
Joined: 07 Jun 2008
Total Posts: 5483
08 Feb 2016 08:41 AM
You use .. to concatenate not ,
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 08:42 AM
That doesn't matter, he wasn't concatenating here.
Report Abuse
triode is not online. triode
Joined: 13 Aug 2011
Total Posts: 5844
08 Feb 2016 08:46 AM
for i = 1, #Table:GetChildren() do
if Table[i] == value then
--
end end

Or for dictionaries:

If Dictionary[value] then
Report Abuse
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
08 Feb 2016 09:58 AM
I was, I am just not posting the entire reader.
Alright, here goes.

function TableRead(Table)
if Table~=nil then
print("TABLE READOUT START\nTABLE CONTENT = "..#Table)
for ItemN, Item in pairs(Table) do
--if Item~=Table --[[the problem line]]--
print(ItemN..": "..Item)
--end --[[end to the problem if line]]--
end
print("TABLE READOUT END\n")
else
print("TABLE NOT FOUND\n")
end
end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 10:00 AM
'print(ItemN..": "..Item)'
That's where it is.
Either ItemN or Item (Or both) are a table.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
08 Feb 2016 10:01 AM
type(value)

If I have a table t: print(type(t))
> "table"
Report Abuse
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
08 Feb 2016 10:02 AM
Yeah Item is a table in d[2]
d={string,{string,brickcolor},num}

So I made the if Item~=Table line
but that threw an error
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
08 Feb 2016 10:05 AM
"So I made the if Item~=Table line
but that threw an error"

Yeah because that's not how you check if an item is a table. If you want to check if it's a table, it's type(Item)~="table".
Report Abuse
haskjdfsask is not online. haskjdfsask
Joined: 08 Jun 2014
Total Posts: 810
08 Feb 2016 12:43 PM
Yep, Thannks!
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