CC: Tweaked

CC: Tweaked

59M Downloads

Encrypted Bytecode/string.dump and bytecode loading support

SoniEx2 opened this issue ยท 1 comments

commented

We have a very slow programming language compiler implemented in pure Lua that compiles to Lua (source code) and given how painfully slow it is and how often CC-Tweaked programs are short-lived, it would be useful if we could precompile said programs!

Benefits of encrypted bytecode:

  • Not portable. At all. The bytecode would not be compatible across in-game computers, even within the same world.
  • Encryption allows to safely use "unsafe" serialization technologies, like ObjectInputStream.
  • Doesn't require us to rewrite our programming language's load() function, which currently checks for bytecode by comparing the first byte of string.dump: is_bytecode = data:sub(1,1) == string.dump(function() end):sub(1,1)

Disadvantages include:

  • Cryptography can be hard to get right.
  • May be a lot of work, especially if the only real benefit is that the entity opening this issue can avoid rewriting its load function... (But hey, does it hurt to ask...?)
commented

Bytecode is gone as of the update to Lua 5.2. I'm afraid I have no interest in bringing it back in any form.