[Overview][Types][Classes][Procedures and functions] | Reference for unit 'pLua' (#pLua)

# plua_callfunction

## Declaration

Source position: plua.pas line 29

`function plua_callfunction(`
`L: Plua_State;`
`FunctionName: AnsiString;`
`const args: array of Variant;`
`results: PVariantArray = nil;`
`TableIndex: Integer = LUA_GLOBALSINDEX`
`):Integer;`

## Arguments

`L` |  | PLua_State to work with.
`FunctionName` |  | Name of the function to call.
`args` |  | Array containing all of the arguements to be passed to the function.
`results` |  | Pointer to a TVariantArray to place the result values into. If NIL then the result values will not be returned.
`TableIndex` |  | Table index to look for the function in, if none is specified then LUA_GLOABLSINDEX is used. Thus, checking for global functions.

## Function result

Total number of values left on the Lua stack from the function.

## Description

Call the given function name with the arguements provided (if it exists) and returns the number of results left on the Lua stack.

## See also

plua_functionexists |  |