Call as
Functions.text.ends_with(str, ending)
Record it as a dependency named Functions.text.ends_with (accepting the completion does this), then call it by that name.
What it does
Test a literal byte suffix using a Lua string slice. Empty suffixes match; pattern characters have no special meaning and case is preserved.
Arguments
| Name | Type | What it does |
|---|---|---|
str | string | Text to inspect. |
ending | string | Literal suffix, including an empty suffix. |
Returns
| 1 | boolean | Whether the text ends with the exact suffix. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
Example
local name = UnitName("target") or ""
return Functions.text.ends_with(name, "Totem")Source
Functions/text.lua, line 70. Read only in game; Duplicate makes an editable copy.
Functions.text.ends_with(str, ending)
return ending == "" or str:sub(-#ending) == ending