CallFunc

From Liberty Unleashed Wiki
Revision as of 23:49, 24 November 2010 by Windlord (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function will call a function from another loaded script.

Syntax

  1. CallFunc( string scriptPath, string funcName, params )

Arguments

  • scriptPath - The path of the script including the folder and filename
  • funcName - The function being called
  • params - Any parameters which need to be passed

Example

This example will call a function from Scripts/SomeScript/main.nut when a player types /somecmd.

  1.  
  2. function onPlayerCommand( id, cmd, text )
  3. {
  4. if ( cmd == "somecmd" )
  5. {
  6. CallFunc( "Scripts/SomeScript/main.nut", "SomeFunction", "param1", 2 );
  7. }
  8. return 1;
  9. }
  10.  

Notes

The function onPlayerCommand is used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox