So, I have a script and a module script, and for some reason, when I call a function in the module script, I get an extra argument in the function, which I did not put there.
Script:
local module = require(script.Parent.Module)
module.something(1,2,3)
Module script:
local module
module.something = function(one,two,three)
print(one,two,three)
end
return module
I am worried that this is a backdoor of some sort because when I tried to print it, this showed up in my output.
Knowing that I didn’t put that there, I then made a for loop to loop through this “table” and print out the value in the table each time it looped. this is what I saw:
Can somebody please tell me what this is? Is it a backdoor?
EDIT: this only happens if I use a specific script to call the function.
This isn’t a backdoor, it is just an error with your code.
If that is the exact code in your ModuleScript you forgot to return the function and also with what you are trying to do put the function in a table to be returned. You also can’t assign functions to variables like the way you did in your code:
local module = {}
module.something = function(one,two,three)
print(one,two,three)
end
return module
Alternatively I prefer to set my modules out like this:
local module = {}
function module.something(one,two,three)
print(one,two,three)
end
return module
If I’m not mistaken, this is usually normal when calling tables/arrays a certain way. Its like getting their “key” or table in a different language. If it only appears to be happening when you call the function, I believe its fine however, if you’re afraid, you can try reading the module script and seeing what it does.
In terms of the actual problem: It’s probably printing the table because you’re calling module:something with colon syntax. You didn’t show yourself doing this, but there’s no reason this code should print a table.