How do I insert a tuple to a table?

So I’m using pcall function which returns tuple arguments:

function CheckUser(Name)
	local success, returned = pcall(function()
	    return plrs:GetUserIdFromNameAsync(Name)
	end)
	return success,returned
end

How would I insert the arguments into a table?

	for i = 1,3 do
		table.insert(NPCIds, {Success =  CheckUser(NPCs["npc"..i].TextBox.Text), Result = CheckUser(NPCs["vibenpc"..i].TextBox.Text) } )
		print(Vibeids[1].Success) -- only print the first argument, which is success
	end

My expected result will be:

print(NPCs[1].Success)  -- true (success)
print(NPCs[1].Result)  -- 5027420 (returned)

print(NPCs[2].Success)  -- false(success)
print(NPCs[2].Result)  -- because this user doesn't exist (returned)

This is my best guess at what your table.insert line is supposed to do. Lmk if I got it wrong.

for i = 1, 3 do
    local success, returned = CheckUser(NPCs["npc" .. i].TextBox.Text)
    table.insert(NPCIds, {Success = success, Result = returned})
    local successVibe, returnedVibe = CheckUser(NPCs["vibenpc" .. i].TextBox.Text)
    table.insert(Vibeids, {Success = successVibe, Result = returnedVibe})
end

Sorry my bad! vibenpc is same variable as npc, I forgot to change th at to npc when I post this :sweat_smile:

It works! Thanks.

	for i = 1, 3 do
	    local success, returned = CheckUser(NPCs["npc"..i].TextBox.Text)
	    table.insert(NPCids, {Success = success, Result = returned})
	end