Thread: GetAnchor() ?
View Single Post
04/14/14, 05:34 PM   #9
Halja
 
Halja's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 111
Originally Posted by Edda View Post
Just tried your example and it worked perfectly !

I didn't know at all about this way of instancing a function's return values.

I honestly thought var = MyElement:GetAnchor(MyElement.anchorIndex) would instance a table/array into 'var' that you could access via offsetx = var.offsetX

Looks like I was wrong

So - another thumbs up and and hats down for you
In lua you are doing the kind of the opposite. You are taking an array return and unpacking it to the individual variables to access. If you don't catch them all, they are just tossed away. That is why you only had the first return value on the initial attempt to use it.

I'll have to look at your index question when I get home. I thought is was an integer reference.
  Reply With Quote