So I have a map with icons that a player can place into and the script creates an image label for the icon. The script gets confused if there’s more than one icon with the same name so that’s what I am trying to accomplish with the variables.
local Icons = {}
local Proto = {}
function Proto:Add(ContentString, ID)
if ID then
self[ID] = ContentString
return ID
end
table.insert(self, ContentString)
return table.find(self, ContentString)
end
setmetatable(Icons, {
__index = Proto,
__call = function(self, Term)
assert(type(Term) == "number", "Invalid term for icon table!")
if Term <= table.getn(self) then
return self[Term]
end
end
})
-- Usage:
local FriendlyHQ1 = Icons:Add("http://www.roblox.com/asset/?id=8349723011")
local Result = Icons(1)
-- Test:
print(Result)
Edit: And if you want me to, I could make you a simple function to parse a jumble of these assets from a string and insert them consecutively into the table (Ideally this would result in you just pasting a large string full of icon urls, and calling the function with it as a parameter.)