411 REFERENCE · Wikibooks
Lua Programming/dofile
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
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
dofile("sayit.lua")
dofile("sayit.lua")