What this script does
Summarize outcomes supplied by your own test harness while keeping observed frequency separate from configured or true probability.
- Best for
- Checking demo loot tables, hatch prototypes, test seeds, and small balancing samples in a Studio project.
- Language
- Luau
- Version
- 1.0.0
- Validation
- Luau runtime tested
Official Luau 0.735 parsing and strict analysis pass, and the module is covered by the pure-module runtime behavior harness.
Included behavior
- Outcome counts and frequencies
- Longest target-free gap
- No configured odds required
Install in the stated runtime
- 1Create a ModuleScript named DropAudit.
- 2Paste the complete source and require it from a server or test Script in your own experience.
- 3Feed completed outcomes from your own test and label the result as an observed sample, not a guaranteed probability.
Minimal usage example
local DropAudit = require(script.Parent.DropAudit)
local summary = DropAudit.summarize({ "Common", "Rare", "Common" })
print(summary.counts.Common, summary.frequencies.Rare)
print(DropAudit.longestGapWithout({ "Rare", "Common", "Common" }, "Rare"))Example inputs and result
- Supply
- An outcome list and, for gap analysis, a target outcome name.
- Expect
- Summarizes observed counts and frequencies or the longest gap in that sample.
These notes explain the example above. Read the complete source for every exported function and edge case before integrating it.
Complete source
No hidden import, minified block, or shortened loader.
--!strict
-- MIT License. Summarizes outcomes you supply; it does not reveal or alter a live game's odds.
export type DropSummary = { total: number, counts: { [string]: number }, frequencies: { [string]: number } }
local DropAudit = {}
function DropAudit.summarize(outcomes: { string }): DropSummary
local counts: { [string]: number } = {}
for _, outcome in outcomes do
assert(outcome ~= "", "Outcome cannot be empty")
counts[outcome] = (counts[outcome] or 0) + 1
end
local frequencies: { [string]: number } = {}
for outcome, count in counts do
frequencies[outcome] = if #outcomes == 0 then 0 else count / #outcomes
end
return { total = #outcomes, counts = table.clone(counts), frequencies = frequencies }
end
function DropAudit.longestGapWithout(outcomes: { string }, target: string): number
assert(target ~= "", "Target cannot be empty")
local longest = 0
local current = 0
for _, outcome in outcomes do
if outcome == target then
longest = math.max(longest, current)
current = 0
else
current += 1
end
end
return math.max(longest, current)
end
return table.freeze(DropAudit)
afde9c571c14bc21cb553a8310c42aea4eee76c8fb99725a53967f5c3b67d312Outside this script’s scope
- Reveal current Steal An Egg odds
- Predict the next result or improve luck
Found a problem or a better approach?
Tell us what failed, what you expected, and whether the issue happened in the Luau CLI or Roblox Studio. Suggestions for clearer types, safer server checks, or a more useful API are welcome.