diff options
author | gumi <git@gumi.ca> | 2018-07-26 16:46:40 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-07-28 09:48:44 -0400 |
commit | 2452b21bead32ee545731fd00b48f1cbc2a1ec11 (patch) | |
tree | 7542179cf86e523bdaac597351f2c9ba581f6bac | |
parent | 0bb3fb39da9bb9170ec2808a3f6caba2a744b2e9 (diff) | |
download | hercules-2452b21bead32ee545731fd00b48f1cbc2a1ec11.tar.gz hercules-2452b21bead32ee545731fd00b48f1cbc2a1ec11.tar.bz2 hercules-2452b21bead32ee545731fd00b48f1cbc2a1ec11.tar.xz hercules-2452b21bead32ee545731fd00b48f1cbc2a1ec11.zip |
update the documentation for is_function
-rw-r--r-- | doc/script_commands.txt | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 44937a34d..6d906c5e9 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1977,18 +1977,35 @@ prontera,150,150,0 script TestNPC 123,{ *is_function("<function name>") -This command checks whether a function exists. -It returns 1 if function is found, or 0 if it isn't. +This command checks whether or not a function exists and returns its type. +Returns false if it cannot be found. + +return values: + + FUNCTION_IS_COMMAND - built-in script command (eg: mes, select, ...) + FUNCTION_IS_GLOBAL - user-defined global function (callable with callfunc) + FUNCTION_IS_LOCAL - user-defined local function + FUNCTION_IS_LABEL - user-defined label function (callable with callsub) Example: - function script try { + function script func1 { dothat(); } - script test FAKE_NPC,{ - .@try = is_function("try"); // 1 - .@not = is_function("notafunction"); // 0 + function func2 { + do_something(); + } + + func3: + end; + + is_function("func1"); // FUNCTION_IS_GLOBAL + is_function("func2"); // FUNCTION_IS_LOCAL + is_function("func3"); // FUNCTION_IS_LABEL + is_function("select"); // FUNCTION_IS_COMMAND + is_function("invalid"); // false } --------------------------------------- |