dofile
Loads and then runs a file, using loadfile. The following is what the internals of this function look like:
function dofile(fileName)
  local f = assert(loadfile(fileName))
  return f()
end
  | 
  |||
| Code | <nowiki>
local myFileData = dofile("someFile")
</nowiki>
 | 
    ||
| Output | Nothing, unless there is an error in someFile | 
    ||
Functions  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Lua | 
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CC:Tweaked | 
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dofile Function  | |
|---|---|
| 
Syntax dofile( 
  | |
| Returns | whatever the file returns | 
| API | Base globals | 
| Source | CC:Tweaked (source) | 
    This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.