Added ToInt() and ToDouble() functions to ZScript string

https://forum.zdoom.org/viewtopic.php?t=57678
This commit is contained in:
alexey.lysiuk 2017-08-25 15:09:18 +03:00
parent 2f3cd7775a
commit 7b98fdb910
2 changed files with 15 additions and 0 deletions

View File

@ -1280,3 +1280,16 @@ DEFINE_ACTION_FUNCTION(FStringStruct, ToLower)
self->ToLower();
return 0;
}
DEFINE_ACTION_FUNCTION(FStringStruct, ToInt)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_INT_DEF(base);
ACTION_RETURN_INT(self->ToLong(base));
}
DEFINE_ACTION_FUNCTION(FStringStruct, ToDouble)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
ACTION_RETURN_FLOAT(self->ToDouble());
}

View File

@ -664,6 +664,8 @@ struct StringStruct native
native int LastIndexOf(String substr) const;
native void ToUpper();
native void ToLower();
native int ToInt(int base = 0) const;
native double ToDouble() const;
}
class SectorEffect : Thinker native