Hmmm, am I losing something? what is so funny about the post? (legit question)
This is heavily obfuscated Lua, and it’s doing two main things:
Decompression / de-obfuscation of byte-encoded Lua
Runtime logic for an MGU/KERS controller (Assetto Corsa / sim racing context)
ChatGPT can decode it, but tells me the one you provided is incomplete and parts are missing from the bottom.
Deobfuscated Lua part
-- Module: a_urd_mgu
local ac = ac
local car = car
local sim = sim
-- Script setup values
local mguCutoffSpeed = getScriptSetupValue("MGU_MINDS")
local mguDeploySpeed = getScriptSetupValue("MGU_MAXDS")
local kersMult = getScriptSetupValue("kersmult")
-- LUTs per BOP
local lut_car0 = DataLUT11("power_520.lut")
local lut_car1 = DataLUT11("power_470_50.lut")
local lut_car2 = DataLUT11("power_480_40.lut")
local lut_car3 = DataLUT11("power_490_30.lut")
local lut_car4 = DataLUT11("power_500_20.lut")
local lut_car5 = DataLUT11("power_510_10.lut")
-- Runtime state
local lastRPM = 0
local kersButton = 0
local armed = false
local timer = 0
local delayTicks = 200
local lastDeployRPM = 0
local outputTorque = 0
-- Cached setup values
local minRPM = getScriptSetupValue("MGU_MINDS")
local maxRPM = getScriptSetupValue("MGU_MAXDS")
-- Helper: select LUT based on car index
local function selectDeployLUT()
if car.index == 1 then return lut_car1 end
if car.index == 2 then return lut_car2 end
if car.index == 3 then return lut_car3 end
if car.index == 4 then return lut_car4 end
if car.index == 5 then return lut_car5 end
return lut_car0
end
-- Reset function
local function reset()
kersButton = 0
controllerInputs[5] = 0
armed = false
timer = 0
end
-- Main update loop
local function update(dt)
local deployValue = 0
local lut = selectDeployLUT()
-- Safety: pitlane or stopped
if car.isInPitlane or car.speedKmh * 100 < 1 then
deployValue = lut:get(car.ratio)
else
deployValue = lut:get(car.ratio)
end
-- Compute torque override
outputTorque = (deployValue * kersMult) / car.drivetrainTorque
car.overrideGasInput(outputTorque)
-- RPM window logic
if car.rpm > minRPM and car.rpm < maxRPM then
kersButton = 1
else
kersButton = 0
end
controllerInputs[5] = kersButton
-- RPM change resets arming
if lastRPM ~= car.rpm then
armed = false
lastRPM = car.rpm
end
-- Delay / lockout logic
if armed then
if timer < delayTicks then
timer = timer + 1
else
car.overrideGasInput(math.huge)
timer = 0
armed = false
end
end
-- Debug
ac.debug("MGU_MINDS", minRPM)
ac.debug("MGU_MAXDS", maxRPM)
ac.debug("BOP_POWER", deployValue)
ac.debug("controllerInputs[5]", controllerInputs[5])
ac.debug("MGU_OUTPUT", outputTorque)
end
return {
update = update,
reset = reset
}