Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Tables?

Asked by 10 years ago

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
0
Message me @jillmiles1 on ROBLOX and I can give you the answer ( otherwise almost the full script) But you 90% of this correct. MessorAdmin 598 — 10y
0
And the catagory is 8 Keyword would be your Message like Fedora = Keyword. MessorAdmin 598 — 10y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

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.

0
So it's a table within a table? kevinnight45 550 — 10y
0
If so how would I access that table? kevinnight45 550 — 10y
1
Yes. adark 5487 — 10y
1
for _, z in pairs(v) do -- end adark 5487 — 10y
View all comments (2 more)
0
Thanks it worked another question though are  well these be considered metatables? kevinnight45 550 — 10y
0
No. Sorry for the late response. Metatables ~= nested tables. adark 5487 — 10y
Ad

Answer this question