From 5d83ee5e891d4da3be95a1d7eb9f74e69f856786 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 12 Nov 2017 14:44:21 +0200 Subject: [PATCH] Exposed String.Remove() function to ZScript https://forum.zdoom.org/viewtopic.php?t=58402 --- src/scripting/thingdef_data.cpp | 9 +++++++++ wadsrc/static/zscript/base.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 540b61a367..c746c536d7 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -1225,6 +1225,15 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Truncate) return 0; } +DEFINE_ACTION_FUNCTION(FStringStruct, Remove) +{ + PARAM_SELF_STRUCT_PROLOGUE(FString); + PARAM_UINT(index); + PARAM_UINT(remlen); + self->Remove(index, remlen); + return 0; +} + // CharAt and CharCodeAt is how JS does it, and JS is similar here in that it doesn't have char type as int. DEFINE_ACTION_FUNCTION(FStringStruct, CharAt) { diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 9cba0cb092..89dd0ab7df 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -684,6 +684,7 @@ struct StringStruct native native String Left(int len) const; native String Mid(int pos = 0, int len = 2147483647) const; native void Truncate(int newlen); + native void Remove(int index, int remlen); native String CharAt(int pos) const; native int CharCodeAt(int pos) const; native String Filter();