Is it possible to change strings (content and size) in Lua bytecode so that it will still be correct? It's about translating strings in Lua bytecode. Of course, not every language has the same size for each word...
相关问题
- How to get the return code of a shell script in lu
- how to split a list into a given number of sub-lis
- Generate string from integer with arbitrary base i
- Converting a string array to a byte array
- How to convert a string to a byte array which is c
相关文章
- JSP String formatting Truncate
- Selecting only the first few characters in a strin
- Python: print in two columns
- java.lang.VerifyError: Stack map does not match th
- extending c++ string member functions
- Understanding the difference between Collection.is
- Google app engine datastore string encoding proble
- How to measure complexity of a string?
Yes, it is if you know what you're doing. Strings are prefixed by their size stored as an int. The size and endianness of that int is platform-dependent. But why do you have to edit bytecode? Have you lost the sources?
After some diving throught Lua source-code I found such a solution:
Firstly, we have start Lua VM and load the script we want to modify. Compiled or not, doesn't matter. Then build a Lua function prototype, parse and change it's constant table. Dump Prototype to a file.
I hope You got that for the basic idea.
You can try using the decompiler LuaDec. The decompiler would allow the strings to be modified in generated Lua code similar to the original source.
ChunkSpy has A No-Frills Introduction to Lua 5.1 VM Instructions that may help you understand the compiled chunk format and make the changes directly to bytecode if necessary.