Why is this printing out one value for each table and how do I fix it?
It's just printing:
http://roproxy.tk/catalog/json?Keyword=DJ Earworm&Category=9&ResultsPerPage=2
1: table: 1CFE5280
Audio
2: table: 1CFE56A0
Audio
When theirs more values in the table:
[{"AssetId":187411559,"Name":"DJ Earworm - Summermash 120 seconds","Description":"Audio","Url":"/DJ-Earworm-Summermash-120-seconds-item?id=187411559","PriceInRobux":"","PriceInTickets":"","Updated":"1 month ago","Favorited":"1 time","Sales":"22","Remaining":"","Creator":"FireFume","CreatorUrl":"/User.aspx?ID=30719032","PrivateSales":"","PriceView":0,"BestPrice":"","ContentRatingTypeID":0,"AssetTypeID":3,"CreatorID":30719032,"CreatedDate":"\/Date(1416187543210)\/","UpdatedDate":"\/Date(1416187543223)\/","IsForSale":false,"IsPublicDomain":true,"IsLimited":false,"IsLimitedUnique":false,"MinimumMembershipLevel":0},{"AssetId":162880181,"Name":"DJ Earworm - Mash Up for What ","Description":"Audio","Url":"/DJ-Earworm-Mash-Up-for-What-item?id=162880181","PriceInRobux":"","PriceInTickets":"","Updated":"6 months ago","Favorited":"2 times","Sales":"67","Remaining":"","Creator":"tigerwhit4","CreatorUrl":"/User.aspx?ID=40632244","PrivateSales":"","PriceView":0,"BestPrice":"","ContentRatingTypeID":0,"AssetTypeID":3,"CreatorID":40632244,"CreatedDate":"\/Date(1403570650790)\/","UpdatedDate":"\/Date(1403570667263)\/","IsForSale":false,"IsPublicDomain":true,"IsLimited":false,"IsLimitedUnique":false,"MinimumMembershipLevel":0}]
Script:
function GetValues(Table) for i,v in pairs (Table) do for _,k in pairs (v) do return k end end end Module = require(script.Parent) Assets = Module.SearchCatalog("DJ Earworm","Audio",2) for i,v in pairs(Assets) do print(i..": ",v) print(GetValues(Assets)) end
Module:
local module = {} ------------------------------------------------------- function FindIndex(Table,Value) for i,v in pairs (Table) do if v == Value then return i end end end ------------------------------------------------------- module.SearchCatalog = function (Keyword,Catergory,ResultsPerPage) CatergoryTable = {"Revelance","Hats","TShirts","Packages","Gear","Models","Plugins","Decals","Audio"} local Service=game:GetService('HttpService') Url='http://roproxy.tk/catalog/json?Keyword='..Keyword..'&Category='..FindIndex(CatergoryTable,Catergory)..'&ResultsPerPage='..ResultsPerPage print(Url) WebRequest = Service:GetAsync(Url, true) AssetsTable = Service:JSONDecode(WebRequest) --for i,v in pairs(AssetsTable) do return AssetsTable -- end end ------------------------------------------------------- return module