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

How would I get an array without using a i,v loop?

So I know in a table

Table = {ScriptingHelperAdminsAreSoBad = 'I Know Right', DevForumAdminsAreBetter = 'Yes'}

-- You can just do

print(Table.DevForumAdminsAreBetter)
--or
print(Table['DevForumAdminsAreBetter'])


But what if I had a table array like this


local Tab = {'G','F','G','E','C','T',"T",'G','I','F',"F",'R','GucciGang',"I",'D','A','Y'}

How would I print GucciGang right away since I cant just do

Tab.GucciGang since there is no key

2 comments

0

"Table = {ScriptingHelperAdminsAreSoGay = 'I Know Right'", lol

0

Well, if you would follow the rules and not do stuff that would break them, there would not be a problem. Post edited for content in violation of Global Guidelines Rule #1.

2 answers

✓ Accepted answer

Here, the index position would actually be just sequential numbers, but if you don't want to use in pairs, you could do this:

local Tab = {'G','F','G','E','C','T',"T",'G','I','F',"F",'R','GucciGang',"I",'D','A','Y'}

for index = 1, #Tab do
if Tab[index] == "GucciGang" then
	print(index, "GucciGang")
end

You can't find a table entry with a specific value without iteration, iirc.

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