Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What is ". . ." in the MainModule in EISS?

Asked by 8 years ago

In Epix Admin's MainModule, I see . . . in some places. This is what I mean:

local MainScriptFunction = function(server,Plugins,LoaderScript) --server is known as "set" in the loader/settings
local server,Plugins,LoaderScript=server,Plugins,(LoaderScript or script)
local DebugErrorsLog={} local function logError(plr,error) DebugErrorsLog[#DebugErrorsLog+1]={Player=plr,Error=error} end
local print=function(...) for i,v in pairs({...}) do print('[EISS] Server - '..tostring(v)) end end
local cPcall=function(func,...) local function cour(...) coroutine.resume(coroutine.create(func),...) end local ran,error=pcall(cour,...) if error then logError("SERVER",error) print('ERROR: '..error) end end
local Pcall=function(func,...) local ran,error=pcall(func,...) if error then logError("SERVER",error) print('ERROR: '..error) end end
local Routine=function(func,...) coroutine.resume(coroutine.create(func),...) end
if server.TempAdmins and type(server.TempAdmins)=="table" then server.Mods=server.TempAdmins end
pcall(function() workspace.AllowThirdPartySales = true end) -- y u even add this roblox.... y
local DataStore local UpdatableSettings={} for i,v in pairs(server) do  table.insert(UpdatableSettings,i) end
local DataStore;
local RemoteEvent;

Do you know why there is ". . ."?

1 answer

Log in to vote
0
Answered by 8 years ago

The ... is used to create variadic functions, i.e. functions which can take as many arguments as are passed to it. You can define one like this:

function VariadicFunction(...)
    local Args = {...}
    for i, v in ipairs(Args) do
        print(v) -- Note that we could have used print(...) as print is a variadic function, but this is to show how to iterate over those arguments.
    end
end

Note that we put the contents of ... into a table to make iterating easier.

You can also define arguments before the ..., like this:

function VariadicFunction(firstArg, secondArg, ...)

In this case, ... would represent everything after the second argument passed to the function.

Ad

Answer this question