Tharotiger 0 Posted May 9, 2015 Share Posted May 9, 2015 Hey Guys, i just want to ask you Guys for some Inspiration on /tmp Folder usage! I can't get the point of using /tmp Folders in OpenComputers. You could easly store the Data in Global Vars! So, what could i use it for? Quote Link to post Share on other sites
Sangar 92 Posted May 9, 2015 Share Posted May 9, 2015 One use for it is log files. For example OpenOS' event system logs errors in event handlers to /tmp/event.log. Quote Link to post Share on other sites
dgelessus 26 Posted May 9, 2015 Share Posted May 9, 2015 1. Global variables are evil. The only place where you can safely use globals is the interactive Lua shell, which runs inside its own sandbox. Everywhere else you should make all variables local. So far I've never had a situation where I needed to use globals, but I certainly had a few cases where I accidentally used globals instead of locals, which caused some hard to find bugs. 2. Variables are stored in RAM, which is very limited in OC compared to real computers. /tmp is a special filesystem, which (I think) does not count towards computer RAM usage. 3. It's a convenient place to put files when working in the shell without occupying space on the real hard disk. 4. It's guaranteed to be a writable location. The default OpenOS boot disk for example is loaded from the mod files and read-only, however you can still work in /tmp. Quote Link to post Share on other sites