dofile() on client doesn't handle compiled files

Started by ., May 01, 2016, 09:16 PM

Previous topic - Next topic

.

I was able to make an utility (for personal use) which injects a list of scripts into the client then saves the compiled closure to a file in order to secure my client-side scripts. Then I placed the compiled scripts in the 'store/script' folder. And connected to the server. The client downloaded the compiled files and then I tried to load them. However, they were read as strings/text and obviously that's not going to work. Could you implement a dofile() function like the on from the standard library which handles both compiled and regular scripts? Basically, you only need to check if the first 2 bytes of the file are equal to SQ_BYTECODE_STREAM_TAG. And if they are then treat it as a compiled script. Details are in the standard IO library.
.