Hello people. So basically I’ve started making an admin command bar system, and I need a way to get the parameters of a function that you send.
function module.new(name: string, description: string, callback: (any) -> ()) -- I need to get the parameters of the 'Callback' function, and see their type.
I have never seen anybody asking this before, so I’m making a post to see if theres any possible way of doing this, without having to send the arguments as an appart parameter.
You can only get the number of parameters a function has, but not their name or type. Even then, you can only get that information inside of the function, so it’s not very helpful.
local function foo(a, b, c)
print(debug.info(1, "a")) --> 3, false
end
local function bar(a, b, c, d, e, ...)
print(debug.info(1, "a")) --> 5, true
end
foo()
bar()
Try doing it how Cmdr does it, with two or three separate modules per command.