I dealt with many programming languages before and in almost all of them we had the concept of object/array destructuring which saves me tons of time and lines fo code, if you don't know what this is then basically say i have object
local obj = {
name = 'something',
lastName = 'somethingElseMaybe',
}
now I want to take out first and last name in a separate variables
local name = obj.name
local lastName = obj.lastName
But with object destructuring I could simply do
local {name, lastName} = obj // This is javascript syntax, kinda
so I was just wondering, is this concept found in Lua too?
**** I NEED TO EMPHASIZE THAT ****
in other programming languages when I try to destructure an object they don't look at the order, so in the example I put above in javascript syntax name, lastName isn't following a specific order, instead javascript looks at the matching keys for those varaible names and ten assign the value of that key to the matching variable NOT CARING ABOUT IF IT MATCHES THE ORDER OR NOT, it only cares about the order when it's an array {'Name', 'lastName'}

3 comments
okay, im editing this since that looks like your real name. Use unpack if you want them as separate objects. local name, lastname = unpack(obj)
Oh, sorry I didn't know putting my real name is against the rules, I just couldn't thing of anything else :P
also it's giving me nil, unless it's an array