View Single Post
07-29-12, 10:46 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
Originally Posted by Aanson View Post
3. I'd like to call a function with several arguments. But say I'd rather not pass the first arg... how do I skip the first argument and move on to the second?

Is it something like...

Lua Code:
  1. MyFunction(_, arg2, arg3)

... Then again, I've tried that and it's returned an error in the past.
In addition to the answer above, there is a lot of misconception going around about "_" being a special character to Lua that skips values. Truth is, Lua just sees it as another variable like "x" or "Y". Its use is more common for disregarding unneeded return values from a function or vararg expression that is faster than using select(). Lua does assign values to the variable "_", but further code usually does nothing with those values.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote