'arg' Gets Blue-Lined in ROBLOX Script Editor

As you can see on this image, the parameter variable “arg,” a built-in Lua function for taking multiple arguments under one name, is blue-lined, indicating a scripting error when, in fact, there is no error at all.

I’ve never heard any such thing, command bar confirms.

> function f(...) print(arg) end f(1,2) nil

You’re wanting to use “…”. In your code,

for i,v in ipairs{...} do

[quote] I’ve never heard any such thing, command bar confirms.

> function f(...) print(arg) end f(1,2) nil

You’re wanting to use “…”. In your code,

for i,v in ipairs{...} do

Doesn’t this prove that it should work as I have?

Nope, the online edition of PiL is for version 5.0.

The behavior is correct. RBX.Lua doesn’t provide the arguments to a variadic function in the [tt]arg[/tt] variable:

function f(...)
	print(arg)
end
f(3,2)
--> nil

You’ll be wanting to do this instead:

function f(...)
	local arg = {n = select('#',...), ...}
	print(arg)
end

[quote]
Doesn’t this prove that it should work as I have? [/quote]

Why are you linking to 5.2 if roblox uses 5.1.4?

[quote]
Doesn’t this prove that it should work as I have? [/quote]

Why are you linking to 5.2 if roblox uses 5.1.4?[/quote]

5.2 is the section number, the book is actually for 5.0 (which is the source of his mistake).

[quote] [quote=“CodeTheorem” post=124092]
Doesn’t this prove that it should work as I have? [/quote]

Why are you linking to 5.2 if roblox uses 5.1.4?[/quote]

5.2 is the section number, the book is actually for 5.0 (which is the source of his mistake).[/quote]

Derp. I assumed it standed for the version 5.2
(And now I think about it, it even isn’t in that version, too, I think)