This is just an example.
Feel free to change, add extra security, anti debug, integrity verification of the caller, load a driver that protects the whole process, internet callbacks, whatever... it's up to you.

Note that decoder.dll must be compatible with CE's manual map method. If you need to do something more fancy, consider using decoder.dll as a loader (loadlibrary works just fine)
The first parameter is a pointer to a table with the following layout:
{
  int version;
  _stdcall_ PLUA_state getLuaState(); //version>=1 (7.7+) : Gets the lua state for the current thread (don't trust it)
}


Also, you can delete these dll's and CE will fallback on some autogenerated code instead


Tip:
during table obfuscation the lua function encodeFunction is called to encode parts of AA scripts that use {$lua} blocks. 
You can override this function yourself and run the script through your own obfuscator