From e477186c0da2f88d39323de390b75ffa08cbf10c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Sep 2015 19:41:33 +0300 Subject: 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 --- src/emap/script.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/emap/script.c') 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; +} -- cgit v1.2.3-70-g09d2