Hiding Code in Advanced Custom Fields

In some cases it may be desirable to obfuscate the code in Lua scripts and Advanced custom fields and prevent them from being edited.  In order to do this, drop a menu.lua script in the data sources Scripts folder, When you next open InDesign this adds a menu option to the data panels pop-out menu which encodes or decodes these scripts. The script requires a key to encode the script and can only be decoded with the same key. Once the data source has been encoded the script can be removed if not required.

Example menu.lua script: