summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script.c15
-rw-r--r--src/emap/script.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 7313d74..73ea165 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -119,6 +119,7 @@ HPExport void plugin_init (void)
addScriptCommand("failedrefindex", "i", failedRefIndex);
addScriptCommand("downrefindex", "ii", downRefIndex);
addScriptCommand("successrefindex", "ii", successRefIndex);
+ addScriptCommand("isstr", "v", isStr);
do_init_langs();
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;
+}
diff --git a/src/emap/script.h b/src/emap/script.h
index 3cf023a..17518a4 100644
--- a/src/emap/script.h
+++ b/src/emap/script.h
@@ -47,5 +47,6 @@ BUILDIN(isUnitWalking);
BUILDIN(failedRefIndex);
BUILDIN(downRefIndex);
BUILDIN(successRefIndex);
+BUILDIN(isStr);
#endif // EVOL_MAP_SCRIPT