Posted 29 June 2013 - 04:21 PM
I have a program that gets a file from rednet and runs it with pcall(function() dofile("file") end). It has the security system that stops program with error() in case of illegal action from program of if user presses F1 button.
1. One error (if user presses F1, error("break key pressed")), instead of sending message to pcall(), prints "break key pressed Press any key to continue" and after pressing any key shuts computer down. Why?
2. term.write() changed into new function: it calls old term.write and saves text into special variable. But: if program uses print(), there aren't newline characters in save variable. If program uses directly term.write with newline character manually added, there aren't newlines at the display, only "?". Why?
3. Security system also includes detection of error() function modifying. But: if program changes error() into other function, or nil, or anything, and at the next linecalls it, it calls the original function! Why?
Full code: http://pastebin.com/Ws1BKVpm
Sorry for my english if I spelled something wrong
1. One error (if user presses F1, error("break key pressed")), instead of sending message to pcall(), prints "break key pressed Press any key to continue" and after pressing any key shuts computer down. Why?
2. term.write() changed into new function: it calls old term.write and saves text into special variable. But: if program uses print(), there aren't newline characters in save variable. If program uses directly term.write with newline character manually added, there aren't newlines at the display, only "?". Why?
3. Security system also includes detection of error() function modifying. But: if program changes error() into other function, or nil, or anything, and at the next linecalls it, it calls the original function! Why?
Full code: http://pastebin.com/Ws1BKVpm
Sorry for my english if I spelled something wrong