This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
UMayBleed's profile picture

os.loadFile

Started by UMayBleed, 05 June 2013 - 08:59 AM
UMayBleed #1
Posted 05 June 2013 - 10:59 AM
I know there is os.loadAPI, but what i am thinking is more of

myFile = os.loadFile("myfile.lua")
myFile.cheesey()


– Contents of myfile.lua

function cheesey()
print("That was easy!")
end

I am pretty sure there is already programs to change this, but make it a part of computer craft.
theoriginalbit #2
Posted 05 June 2013 - 11:30 AM
It already exists. loadfile and dofile are there, both perform slightly different actions.
Lyqyd #3
Posted 05 June 2013 - 12:43 PM
The behavior you describe is no different from os.loadAPI, except that you specified the variable to put the table into. Just create a temporary file with the desired name. You could even create a function to easily do this.

Locked as existing feature/enhancement.