summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/script_commands.txt6
-rw-r--r--src/map/script.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 2dd4fa575..852a003b7 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -8007,17 +8007,19 @@ Breaks a string up into substrings based on the specified delimiter.
Substrings will be stored within the specified string array. Only the 1st
char of the delimiter parameter will be used. If an empty string is passed
as a delimiter, the string will be placed in the array in its original
-form, without any changes.
+form, without any changes. Return the number of elements written to
+<dest_array>.
Example:
- explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
+ .@num_elements = explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
//.@my_array$ contents will be...
//.@my_array$[0]: "Explode"
//.@my_array$[1]: "Test"
//.@my_array$[2]: "1965"
//.@my_array$[3]: "red"
//.@my_array$[4]: "PIE"
+ //.@num_elements: 5
---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index f438de3ab..fedfc895c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14967,6 +14967,8 @@ BUILDIN(explode)
script->set_reg(st, sd, reference_uid(id, start + k), name, (void*)temp, reference_getref(data));
aFree(temp);
+
+ script_pushint(st, k + 1);
return true;
}