Lua Programming/dofile

The dofile builtin function can be used to execute a chunk of code stored in a file. In the following example, we have two files main.lua and sayit.lua. The main program (main.lua) calls the sayit program, which outputs a message to the screen:

-- sayit.lua
print("I am saying hello!")
-- main.lua