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

Loading functions from file

Started by Kaleb702, 16 July 2012 - 03:50 AM
Kaleb702 #1
Posted 16 July 2012 - 05:50 AM
I want to load two functions from an external file. I know where the file will be, but I want to know how to load the file. The reason for this is that two programs will be using the file.

Basically:
How should I load the file to ensure that someone doesn't hack it (or at least prevent it)?
Is it worth it or should I just copy-paste the two long function definitions into both programs?
Xtansia #2
Posted 16 July 2012 - 06:39 AM
Why don't you just use
os.loadAPI(pathToFile)
kazagistar #3
Posted 16 July 2012 - 03:43 PM
If someone has the ability to edit your code, your security is inherently failed. What exactly is the use case of this?
LucasUK #4
Posted 16 July 2012 - 08:28 PM
Kaleb I can understand why you would do this, for example if you have some code that works as:

"draw menu" "Items"

Save it into a central repository, and you can use it for all your apps whenever you want a menu. Update the code, it updates everywhere.



Security wise, its the exact same as coding it in 1 file, if they can edit the main file, they can edit the function file also.