Strings

Jul 1, 2023  │  m. Jul 2, 2023 by Gleb Buzin
local greeting = "Hello, "
local name = "Kenneth Sparks"
print(greeting .. name)

local age = 19
local name = "Laurence"
print(name .. " is " .. age .. " years old")

hi = "Hi!"
io.write(string.len(hi), "\n")
Hello, Kenneth Sparks
Laurence is 19 years old
3

We can create long strings and maintain white space

local longString = [[
I am a very very long
string that goes on for
ever]]
io.write(longString, "\n")
I am a very very long
string that goes on for
ever

String formatting

print(string.format("not true = %s", tostring(not true)))
not true = false


Next: If/Else