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

protection

Started by wilcomega, 01 January 2013 - 06:37 AM
wilcomega #1
Posted 01 January 2013 - 07:37 AM
can i make files read only with a function? yes: what function?
can i protect values and variables to be protected so that they are "read only"? yes: what function?
zekesonxx #2
Posted 01 January 2013 - 08:26 AM
1. You can remake the fs API to check if a file is protected
2. No clue. I'm not sure if Lua has constants.
Orwell #3
Posted 01 January 2013 - 08:41 AM
1. As mentioned by zekesonxx .
2. Lua has no constants but that doesn't matter. You should read up on environments and metatables. You could alter the way the environment table indexes. But still, to make it perfectly secure would be terribly elaborate and you'd have to deep copy each value, otherwise they could use the returned references for altering the values I guess.