mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Refactored the code for "substr" script function
* fixed the crashing bug and added a new behavior. Changed the error message due to missing critter frame (again): * replaced the interruption with printing the error message to in-game message window.
This commit is contained in:
@@ -262,7 +262,10 @@ Some utility/math functions are available:
|
||||
- you can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0))
|
||||
|
||||
> string substr(string, start, length)
|
||||
- cuts a substring from a string starting at "start" up to "length" characters. If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st"). If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te")
|
||||
- cuts a substring from a string starting at "start" up to "length" characters. The first character position starts with 0 (zero).
|
||||
- If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st").
|
||||
- If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te").
|
||||
- If length is zero - it will return a string from the starting position to the end of the string **New behavior** for sfall 4.2.2/3.8.22
|
||||
|
||||
> int strlen(string string)
|
||||
- returns string length
|
||||
@@ -452,6 +455,7 @@ Some utility/math functions are available:
|
||||
|
||||
> array sfall_func2("get_ini_section", string fileName, string section)
|
||||
- returns an associative array of keys and values for a given INI file and section
|
||||
- NOTE: all keys and their values will be of String type
|
||||
|
||||
> int sfall_func0("car_gas_amount")
|
||||
- returns current amount of fuel in player's car (between 0 and 80000)
|
||||
|
||||
Reference in New Issue
Block a user