diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 7cfa53504..f7b84f21b 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -1252,3 +1252,18 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Filter) ACTION_RETURN_STRING(strbin1(*self)); } +DEFINE_ACTION_FUNCTION(FStringStruct, IndexOf) +{ + PARAM_SELF_STRUCT_PROLOGUE(FString); + PARAM_STRING(substr); + PARAM_INT_DEF(startIndex); + ACTION_RETURN_INT(self->IndexOf(substr, startIndex)); +} + +DEFINE_ACTION_FUNCTION(FStringStruct, LastIndexOf) +{ + PARAM_SELF_STRUCT_PROLOGUE(FString); + PARAM_STRING(substr); + ACTION_RETURN_INT(self->LastIndexOf(substr)); +} + diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index f35e39993..b2fd9c6c8 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -656,6 +656,8 @@ struct StringStruct native native String CharAt(int pos) const; native int CharCodeAt(int pos) const; native String Filter(); + native int IndexOf(String substr, int startIndex = 0) const; + native int LastIndexOf(String substr) const; } class SectorEffect : Thinker native