started ch05
This commit is contained in:
3
exercises/ch05/ex5_1.lua
Normal file
3
exercises/ch05/ex5_1.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
local sunday = "monday"; monday = "sunday"
|
||||
local t = {sunday = "monday", [sunday] = monday}
|
||||
print(t.sunday, t[sunday], t[t.sunday])
|
||||
16
exercises/ch05/ex5_3.lua
Normal file
16
exercises/ch05/ex5_3.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local escape_sequences = {
|
||||
["\a"] = "bell",
|
||||
["\b"] = "back space",
|
||||
["\f"] = "form feed",
|
||||
["\n"] = "newline",
|
||||
["\r"] = "carriage return",
|
||||
["\t"] = "horizontal tab",
|
||||
["\v"] = "vertical tab",
|
||||
["\\"] = "backslash",
|
||||
["\""] = "double quote",
|
||||
["\'"] = "single quote"
|
||||
}
|
||||
|
||||
for k, v in pairs(escape_sequences) do
|
||||
print(("k='%s', v='%s'"):format(k, v))
|
||||
end
|
||||
Reference in New Issue
Block a user