diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-18 19:41:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-18 19:41:33 +0300 |
commit | e477186c0da2f88d39323de390b75ffa08cbf10c (patch) | |
tree | 5fd052cae997956e8fecbe1438d19794f5440291 /src/emap/script.c | |
parent | 6115c65dbe02e495f67bf7a8b0cb48725a06c1f3 (diff) | |
download | evol-hercules-e477186c0da2f88d39323de390b75ffa08cbf10c.tar.gz evol-hercules-e477186c0da2f88d39323de390b75ffa08cbf10c.tar.bz2 evol-hercules-e477186c0da2f88d39323de390b75ffa08cbf10c.tar.xz evol-hercules-e477186c0da2f88d39323de390b75ffa08cbf10c.zip |
Add script function for check is parameter string or not.
New script function: isstr
Example:
isstr(10) - will return 0
isstr("test") - will return 1
Diffstat (limited to 'src/emap/script.c')
-rw-r--r-- | src/emap/script.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c index 8c0b15c..18df0b5 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -1357,3 +1357,18 @@ BUILDIN(successRefIndex) return true; } + +// return paramater type +// 0 - int +// 1 - string +// 2 - other +BUILDIN(isStr) +{ + if (script_isinttype(st, 2)) + script_pushint(st, 0); + else if (script_isstringtype(st, 2)) + script_pushint(st, 1); + else + script_pushint(st, 2); + return true; +} |