Hi, I’ve made a class called Command
to deal with type checking for functions that require a Command
to work properly, and it’s defined as so:
export type Command = {
Name: string,
Description: string,
Usage: string,
Examples: {string},
__call: (Player, ...any) -> (),
}
However, it looks like __call
isn’t functioning properly, as anything that requires a function has an underline, like in this function:
local function parseArgsToCommand(fn: CommandType.Command, plr: Player, ...: any)
local args: number, varargs: boolean = debug.info(fn, "a")
-- do + 1 because the first arg is the player
if not varargs and args ~= #... + 1 then
warn("Function " .. fn.Name .. " expected " .. args .. " arguments, but got " .. #... + 1)
return
else
fn(plr, ...)
end
end
and I get the error ServerScriptService.Admin.Main:18: invalid argument #1 to 'info' (function or level expected)
. Does anybody know how I can make a type have an __call
metatable? I could use a second type and make a constructor but that feels clunky.