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

I have problems using the unpack() function, could someone help me out?

lol = {"a", "b"}

if unpack(lol) == "a b" then
	print("yep")
end

It never prints "yep", what is the reason behind that?

1 comment

0

my dude. just unpack into a table then compare via an in-depth function

2 answers

You don't understand Tuples

You can't compare tuples, much less like that. I highly suggest you go read up on how Tuples work.

 t = {"a","b"}

if unpack(t) == "a" and "b" then
    print('yep')
    end

"a b" would be considered as one element. thats the problem

5 comments

0

wrong

0

works fine for me. i don't know why you downvoted

0

I downvoted because it's wrong. Try it with t = {'a', 'b'} but don't change your condition

0

It will (incorrectly) print 'yep'

0

I wrote t={'a','b'} by accident but I meant t={'a', 'c'}

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