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:

01local MainScriptFunction = function(server,Plugins,LoaderScript) --server is known as "set" in the loader/settings
02local server,Plugins,LoaderScript=server,Plugins,(LoaderScript or script)
03local DebugErrorsLog={} local function logError(plr,error) DebugErrorsLog[#DebugErrorsLog+1]={Player=plr,Error=error} end
04local print=function(...) for i,v in pairs({...}) do print('[EISS] Server - '..tostring(v)) end end
05local 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
06local Pcall=function(func,...) local ran,error=pcall(func,...) if error then logError("SERVER",error) print('ERROR: '..error) end end
07local Routine=function(func,...) coroutine.resume(coroutine.create(func),...) end
08if server.TempAdmins and type(server.TempAdmins)=="table" then server.Mods=server.TempAdmins end
09pcall(function() workspace.AllowThirdPartySales = true end) -- y u even add this roblox.... y
10local DataStore local UpdatableSettings={} for i,v in pairs(server) do  table.insert(UpdatableSettings,i) end
11local DataStore;
12local 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:

1function VariadicFunction(...)
2    local Args = {...}
3    for i, v in ipairs(Args) do
4        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.
5    end
6end

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

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

1function VariadicFunction(firstArg, secondArg, ...)

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

Ad

Answer this question