Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:57:20+00:00 2026-05-17T01:57:20+00:00

In World of Warcraft addons, a table is passed as the second vararg: —

  • 0

In World of Warcraft addons, a table is passed as the second vararg:

-- This is often at the top of WoW lua files
local AddonTable = select(2, ...)

Is there a way to do that with regular lua? I’m attempting to write some unit tests with minimal changes to my current code. So far when I just use require, I can use select(1, ...) to get the first parameter to require (the module), but I can’t seem to figure out how to populate the second argument.

Update:

Instead of using require, I can use loadfile to do what I need. When World Of Warcraft loads an addon, it passes the name of the addon and a table that can be populated with your addon’s functions. I can reproduce that functionality with this code:

local addon = loadfile('MyAddon.lua')
local AddonTable = {}
addon('AddonName', AddonTable)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:57:21+00:00Added an answer on May 17, 2026 at 1:57 am

    To rephrase your question:

    First understand that all that is happening in wow is your lua file is being lua_loadfile’d, then the resulting closure is being executed with 2 parameters on the stack.

    This is similar to what require is doing from an outside perspective, but when you think it through it is different.

    Require returns the module – that is the equivalent to the WoW table that is the 2nd arguement. The parameter to require (the name of the module) is the equivalent of the first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a WoW (World of Warcraft) lua script question. Not many of these
World of Warcraft is off the table, because of the WOW Glider Lawsuit of
I am having some trouble with my World of Warcraft addon. Whenever I display
On the World of Warcraft forums they have a neat style set up that
Just learning the world of jquery, and all my googling gives examples like this:
I have a real world program that is similar to this one, which I'll
I'm trying to create a database of World of Warcraft gems. If I go
I want to make an application that is similar to the World of warcraft
I made a launcher for my game server. (World of Warcraft) I want to
For a MMORPG World of Warcraft im trying to write a lib. Money in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.