lua string functions code example

Example 1: lua functions

function myFunction()	-- Start with 'function', give it a name
  -- Do something amazing...
end		-- Finish with 'end'

myFunction()	-- Call the function later in the code

Example 2: Lua string

-- Strings are immutable. Immutable simply means unmodifiable or unchangeable.
a = 'this is a string'

Example 3: 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