12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1020 Part IV ■ <strong>Reference</strong>Arguments:s—A string (string)Returns:s—A string containing the characters <strong>of</strong> string s in reverse order (string)Example:strrev(“abcdef“)-- returns “fedcba“strrev(“nametag“)-- returns “gateman“strrev(“Step on no pets“)-- returns “step on no petS“strsplitSplits a string based on another seperator string.... = strsplit(“sep“, “text“, limit)Also available as string.split (though not provided by the Lua st<strong>and</strong>ardlibrary).Arguments:sep—The seperator string to use (string)text—The text to split (string)limit—The maximum number <strong>of</strong> pieces to split the string into (number)Returns:...—A list <strong>of</strong> strings, split from the input text based on the seperator string(string)Example:-- Split the string “a:b:c:d“strsplit(“:“, “a:b:c:d“, 2)-- Returns “a“, “b:c:d“-- Split the string “a::b::c::d“strsplit(“::“, “a::b::c::d“)-- Returns “a“, “b“, “c“, “d“Lua APIstrsubReturns a substring <strong>of</strong> a string.s = strsub(“s“, firstChar [, lastChar])Alias <strong>for</strong> the st<strong>and</strong>ard library function string.sub.Arguments:s—A string (string)firstChar—Position <strong>of</strong> a character in the string (can be negativeto count backwards from the end <strong>of</strong> the string) (number)lastChar (optional)—Position <strong>of</strong> a later character in the string (can be negativeto count backwards from the end <strong>of</strong> the string); defaults to -1 if omitted (number)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!