-- Example 11 -- numbers.
-- Multiple assignment showing different number formats.-- Two dots (..) are used to concatenate strings (or a-- string and a number).a,b,c,d,e = 1, 1.123, 1E9, -123, .0008print("a="..a, "b="..b, "c="..c, "d="..d, "e="..e) -------- Output ------a=1 b=1.123 c=1000000000 d=-123 e=0.0008
-- Example 12 -- more output.
-- More writing output.print "Hello from Lua!"print("Hello from Lua!") -------- Output ------Hello from Lua!Hello from Lua!
-- Example 13 -- more output.
-- io.write writes to stdout but without new line.io.write("Hello from Lua!")io.write("Hello from Lua!")-- Use an empty print to write a single new line.print() -------- Output ------Hello from Lua!Hello from Lua!
-- Example 14 -- tables.
-- Simple table creation.a={} -- {} creates an empty tableb={1,2,3} -- creates a table containing numbers 1,2,3c={"a","b","c"} -- creates a table containing strings a,b,cprint(a,b,c) -- tables don't print directly, we'll get back to this!!-------- Output ------table: 001EC6D0 table: 001EC7E8 table: 001EC860
-- Example 15 -- more tables.
-- Associate index style.address={} -- empty addressaddress.Street="Wyman Street"address.StreetNumber=360address.AptNumber="2a"address.City="Watertown"address.State="Vermont"address.Country="USA"print(address.StreetNumber, address["AptNumber"]) -------- Output ------360 2a