Auto-translated
As far as I know, the map archive in the map.xdb file should contain a reference to MapScript.xdb, which in turn should contain a reference to MapScript.lua. I don't know what you already have, but in the end, it should look like this, and all the code can be written in this MapScript.lua file.