main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Person = {
  name = "Sam",
  id = 1234
}

print(Person.name)
print(Person.id)

Human = {}

function Human:new(name, id)
  local self = setmetatable({}, Human)
  self.name = name
  self.id = id
  return self
end

Dan = Human:new("Dan", 1985)
print(Dan.name)

for i = 0, 10 do
  print("This is loop " .. i)
end

arrayValue = {5,6,7,8,9}

for i, v in ipairs(arrayValue) do 
  print(v) 
end

tableValue = {
  name = "Dan",
  age = 33
}

for k in pairs(tableValue) do 
  print(k .. ": " .. tableValue[k]) 
end
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio [GCC 4.2.1 (LLVM, Emscripten 1.5)] on linux2