aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/script.lua
blob: 1e4b909d9fd6d4aa7b7f100ec881629035b6a839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- script.lua

-- This works coz LuaJIT automatically loads the jit module.
if type(jit) == 'table' then
  io.write('script.lua is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '\n')
else
  io.write('script.lua is being run by Lua version ' .. _VERSION .. '\n')
end

-- Receives a table, returns the sum of its components.
io.write("The table the script received has:\n");
x = 0
for i = 1, #foo do
  print(i, foo[i])
  x = x + foo[i]
end
io.write("Returning data back to C\n");
return x