Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why are my parameters not carrying across functions properly?

The following code snippet is simplified code from a returned function within a ModuleScript that I intend to use for error handling:

function errorHandling(func, ...)
	local args = {...};
	print(unpack(args));
	local ran,error = pcall(function()
		print(unpack(args));
		local results = { func(unpack(args)) };
	end);
end

And the following code is the function that is being passed to errorHandling as func:

function func(param1, param2)
	print(param1, param2);
end

Now the issue I have is that the first two times I print the unpacked values of the args array it returns the correct values, however when I receive them in the func function and print, the first index has disappeared.

For example, if my arguments (args) are "a" and "b", my output will show:

a	b
a	b
b	nil

I've not been scripting for a few years so it's probably something simple I'm missing, but I'd appreciate the help.

1 answer

You can try ignoring the first parameter in the function and try doing it that way, other wise this is a roblox bug.

2 comments

0

It works so I suspect you're right and it's just a bug.

0

Could you mark my answer as a solution? Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.