summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-29 19:02:00 -0400
committergumi <mekolat@users.noreply.github.com>2017-06-01 12:27:27 -0400
commitb0257f021db382439c6f560e87cfbf1aefc732d2 (patch)
tree23b2178d472d2db195ee1451e2142b5d29c4b23b /src
parentf30edc7f02fb0c290d302d9abc77d970bb05fb62 (diff)
downloadhercules-b0257f021db382439c6f560e87cfbf1aefc732d2.tar.gz
hercules-b0257f021db382439c6f560e87cfbf1aefc732d2.tar.bz2
hercules-b0257f021db382439c6f560e87cfbf1aefc732d2.tar.xz
hercules-b0257f021db382439c6f560e87cfbf1aefc732d2.zip
add buildin isstr()
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 75f747fb6..f83310187 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16132,6 +16132,26 @@ BUILDIN(charat) {
}
//=======================================================
+// isstr <argument>
+//
+// returns 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;
+}
+
+//=======================================================
// chr <int>
//-------------------------------------------------------
BUILDIN(chr)
@@ -23529,6 +23549,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getstrlen,"s"), //strlen [Valaris]
BUILDIN_DEF(charisalpha,"si"), //isalpha [Valaris]
BUILDIN_DEF(charat,"si"),
+ BUILDIN_DEF(isstr,"v"),
BUILDIN_DEF(chr,"i"),
BUILDIN_DEF(ord,"s"),
BUILDIN_DEF(setchar,"ssi"),