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…
Does anyone know how I can silence this or fix this?
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.
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)