4

I have the following test.lua script:

print("before function")
function calc(n)
    print("in function")
    print(10*n)
end

I'm trying to execute it from the command line using lua test.lua calc 10, but the only output I get is:

before function

What should I do to get the following output:

before function
in function
100
Sparkler
  • 2,581
  • 1
  • 22
  • 41

1 Answers1

1

For the following code,

m = {}

print("before function")
function m.calc(n)
    print("in function")
    print(10*n)
end

m[arg[1]](arg[2])

the command lua test.lua calc 10 would output:

before function
in function
100
Sparkler
  • 2,581
  • 1
  • 22
  • 41