View Single Post
01-06-19, 06:47 AM   #4
LanceDH
A Cyclonian
 
LanceDH's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 41
This is off topic to the main question, but in the spirit of explaining code:

... is a collection of multiple variables.
Say you have a
Lua Code:
  1. function test(...)
And you call it using
Lua Code:
  1. test(1, true, "three")
... will contain the values 1, true, and "three" in that order.

When assigning variables, you can assign multiple on a single line
Lua Code:
  1. local a, b, c = ...
Will then assign 1 to a, true to b, and "three" to c
The underscore variables is typically used as a throwaway variable for values you don't care about.
So if you only care for the third variables you can type
Lua Code:
  1. local _, _, value = ...
If I'm not mistaken, the _ will all end up as one variable, so it's both easier to read and more optimized.
It becomes very useful when you have a function which returns a lot of values, but you only need a few.
Lua Code:
  1. local n, _, _, header, _, _, _, id, _, _, _, _, _, _, _, hidden = GetQuestLogTitle(i);
  Reply With Quote