Argument type mismatch

So, I have a custom output/print function. I’m trying to run the function “output” in protected mode (pcall) so it doesn’t terminate the LUA thread when an ltype/output function of “error” is provided.

For some reason however, even in nonstrict mode, it gives me a really confusing warning…
image
Does anyone know how I can silence this or fix this?

try doing this instead

local output, error = pcall(function(ltype, message)
    ltype("[Sandbox: " .. tostring(ltype) .. "] " .. message);
end)

Still not fixed sadly. Do you know anyway I can silence it?

Where exactly is this function coming from? I’m confused. Where did you get “ltype” and “message”

Can you clarify what you mean by where it’s coming from?

Like, what is the “ltype” for, what is the “message” for, where are these, what are these functions?

1 Like

You have 2 parameters for your closure but you provide none with your pcall. The linter tries to convey that but is apparently not displaying the correct warning.

What can I do to silence/fix it?

Provide the arguments ltype and message.

1 Like

pcall will call the function you passed into it with any specified arguments. You’re passing in an anonymous function that takes parameters but the pcall function isn’t actually using them since you didnt provide any arguments.

Would it work if you remove the anonymous function? Assuming that ‘ltype’ is already defined as a function and ‘message’ a string.

local output = pcall(ltype, "[Sandbox: "..tostring(ltype).."] "..message)
1 Like

ltype + message have to be called dynamically and passed down to different modules so it wouldn’t work. Thanks for the information though