Page 1 of 1

Obfuscating your Lua from cheaters

Posted: Sun Oct 21, 2007 12:29 am
by Sophia
If you've created some custom Lua scripts for your dungeon and want to hide it from prying eyes, you'll need to make use of the Lua compiler.

Download luac, and put it in your DSB directory:
https://sourceforge.net/projects/luabin ... p/download
(In this example, we'll assume it's in C:\dsb)

You'll need to use the command line (cmd.exe). First, cd to your dungeon:

Code: Select all

cd \dsb\my_dungeon
Then, invoke luac on your startup file: (the ..\ is needed if you haven't added luac to your path)

Code: Select all

..\luac -s -o startup.lxx startup.lua
To obfuscate your custom objects, do:

Code: Select all

..\luac -s -o objects.lxx objects.lua
You won't typically need to do this for dungeon.lua, as your dungeon will already be compiled into DSB's own internal format in dungeon.dsb. However, if your dungeon.lua is weird (for example, it actually randomly generates a dungeon) and would normally have to be distributed in source form, you will want to obfuscate it like this instead.

Include only the .lxx, not the .lua files, when you distribute the dungeon, and your custom code is safe from cheaters. :)

Note: If you're using a lua_manifest, you won't have to change anything. DSB will automatically try to convert the last two letters of the filename to "xx" and load a compiled Lua script if it cannot find a normal Lua script.