#cp.fn.args

Functions for working with function arguments.


#API Overview

Functions - API calls offered directly by the extension


#API Documentation

#Functions

Signaturecp.fn.args.from(index) -> function(...) -> ...
TypeFunction
DescriptionReturns a function that selects the arguments from the provided index.
Parameters
  • index - The index of the argument to select.
Returns
  • A function that selects the argument at the specified index.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 32

Signaturecp.fn.args.hasAny(...) -> boolean
TypeFunction
DescriptionReturns true if any of the arguments are not nil.
Parameters
  • ... - The arguments to check.
Returns
  • true if any of the arguments are not nil, false if not.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 112

Signaturecp.fn.args.hasNone(...) -> boolean
TypeFunction
DescriptionReturns true if all the arguments are nil.
Parameters
  • ... - The arguments to check.
Returns
  • true if all the arguments are nil, false if not.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 93

Signaturecp.fn.args.only(index, ...) -> function(...) -> any
TypeFunction
DescriptionReturns a function that only returns the argument at the specified index.
Parameters
  • index - The index of the argument to return.
  • ... - The other indexes to include as well.
Returns
  • A function that returns the arguments at the specified indecies.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 9

Signaturecp.fn.args.pack(...) -> table, boolean
TypeFunction
DescriptionPacks the arguments into a table.
Parameters
  • ... - The arguments to pack.
Returns
  • A table containing the arguments.
  • A boolean indicating whether the arguments were packed into a table.
Notes
  • If the number of arguments is 1 and the first argument is a table, and the table has a size of 1 or more, it will be returned.
  • Otherwise, the arguments are packed into a table.
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 47

Signaturecp.fn.args.unpack(args, packed) -> ... | table
TypeFunction
DescriptionUnpacks the arguments from a table.
Parameters
  • args - The arguments to unpack.
  • packed - A boolean indicating whether the arguments were packed.
Returns
  • The arguments, unpacked if necessary.
Notes
  • If the arguments were packed, the table is unpacked first.
  • * Otherwise, the arguments are returned unchanged.
ExamplesNone
Sourcesrc/extensions/cp/fn/args.lua line 72