Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with Tables?

In line 11 its failing to print the values within the table,why and how do I fix it?

It just prints:

Keyword is: Hats

Url is: http://roproxy.tk/catalog/json?Keyword=Hats&Category=1&ResultsPerPage=1

table: 13EE5478

function SearchCatalog(Keyword,Catergory,ResultsPerPage)
local Service=game:GetService('HttpService')
print('Keyword is: '..Keyword)
Url='http://roproxy.tk/catalog/json?Keyword='..Keyword..'&Category='..Catergory..'&ResultsPerPage='..ResultsPerPage
print('Url is: '..Url)
WebRequest = Service:GetAsync(Url, true)
AssetsTable = Service:JSONDecode(WebRequest)
return AssetsTable
end

Table = SearchCatalog("Hats",1,1)
for i,v in pairs(Table)do
	print(v)
end

2 comments

0

Message me @jillmiles1 on ROBLOX and I can give you the answer ( otherwise almost the full script) But you 90% of this correct.

0

And the catagory is 8 Keyword would be your Message like Fedora = Keyword.

1 answer

✓ Accepted answer

The contents of Table is itself a Table, as you can see from the print statement on line 13.

You have to loop through that table to actually read any data.

6 comments

0

So it's a table within a table?

0

If so how would I access that table?

1

Yes.

1

for _, z in pairs(v) do -- end

0

Thanks it worked another question though are  well these be considered metatables?

0

No. Sorry for the late response. Metatables ~= nested tables.

This discussion is preserved as it was. New answers, comments, and votes are closed.