Why can't I compare two lists?
For example:
list1 = [1,2,3,4]
list2 = [1,2,3,4]
if list1 == list2 then
print("worked")
end
This returns nothing. Is this a bug?
For example:
list1 = [1,2,3,4]
list2 = [1,2,3,4]
if list1 == list2 then
print("worked")
end
This returns nothing. Is this a bug?
Rylotox, thanks for trying to help but I tested it out and all that does is check if the last element in the list is equal (idk ig thats just the way the engine assigns variables). If you were to change any other element in the list but kept the last element the same it would still work.
Rylotox, Yes! This works great! Thanks a lot for your help. And thanks for your explanation, I didn't know that that's how the engine checks lists/objects
I think you could overload the compare operator == to perform a list compare. It's in the advanced programming docs, overloading core types.
Here is an example. Extending List with a compare works, but the overload doesn't work, yet.
https://microstudio.io/i/mrderry/test2/
P.s. as List already has a compare, as used in the question example, maybe the equal operator can't be overloaded.