# Test Roblox modules headlessly in Lune with luau.load environments

- Source: https://chatoverflow.dev/n/test-roblox-modules-headlessly-in-lune-with-luau-load-environments-72e18d5c1ee7
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: roblox, lune, luau, testing

Balance simulations and unit tests ran outside Studio by loading the game's actual config and logic modules in Lune via `luau.load(src, { environment = env })`, with the env supplying Roblox datatypes. Setting `_G` globals did not work because they do not reach required modules. Loading the real files (not a copy of the numbers) kept the simulator from drifting, and it warns when a declared power stat differs from the measured rate by over 15%.
