{{luaapi}}
(Use Lua/Libshortcut template. Change category from "LUA Functions" to "Lua functions".) |
({{luaapi}}) |
||
| Line 1: | Line 1: | ||
{{ | {{luaapi}} | ||
Return the length, in bytes, of the string passed. | |||
string.len(s) | string.len(s) | ||
strlen(s) | |||
== Examples == | |||
s = "Lua" | |||
print(string.len("Lua"), s:len(), #s) -- 3,3,3; the three methods are equivalent | |||
print(string.len("Lua\000user")) -- 8: Lua strings are 8 bit pure so \000 does not terminate | |||
== See also == | |||
* {{api|strlenutf8}} - for utf8-aware string length parsing. | |||
{{ | |||