2
votes

I have a function

function f1(msg) return value end

in Lua file A.lua, how i can call this function or the return result of this function from a B.lua Thank you Jp

2

2 Answers

6
votes

You use the require function ( http://www.lua.org/pil/8.1.html )

require("A")
f1("my message")
1
votes

As a complement to brianm, you can also

dofile("A.lua")
f1("blah")

or

local chunk = assert(loadfile("A.lua"))
chunk()
f1("blah")