Lua string length

This article is tagged with: Lua string length and lua

lua string length

-- One can get the length of a string by using the # (length) operator.
-- The metamethod for this operator is __len.
local str = "Hello world!";
print(#str); -- 5

This article is tagged with: Lua string length and lua