aimodel.getHandlerScript

Get a handle to the script of a handler.

Prototype

  1. hResource = aimodel.getHandlerScript ( hAIModel, sName|nIndex )

Description

Get a handle to a handler of a function, either by name or by index. Useful to extract further information, like function arguments.


Parameters

hAIModel - valid AIModel handle
sName|nIndex - handler name string or index 1..nHandlerCount


Return values

hResource - script handle


Sample

  1. for iIndex = 1, nHandlersCount do
  2. local hItem = tItems[ iIndex ]
  3. if ( hItem ) then
  4. local sHandlerName = tSortedHandlers[ iIndex ]
  5. local hHandlerScript = aimodel.getHandlerScript ( hResource, sHandlerName )
  6. local tHandlerArguments = hHandlerScript and script.findFunctionArguments ( hHandlerScript ) or { }
  7. -- etc.

Available since ShiVa 2.0