no-table-create-map
errorSuggestion
Reports .map(...) called directly on table.create(...) or new Array(...).
Rule details Suggestion
Section titled “Rule details Suggestion ”The rule only looks for the direct pattern. These are reported:
table.create(...).map(...)new Array(...).map(...)
It does not report cases where you store the result first, add another method call before map, or shadow table or
Array with your own local definitions.
For new Array(...), the rule only matches constructors with one or two arguments.
Examples
Section titled “Examples”Incorrect
Direct construct-then-map chain
Section titled “Direct construct-then-map chain”const mapped = table.create(total, fallback).map((value) => value);const rewards = new Array<Reward>(size).map(() => makeReward());Correct
Allocate first, then fill
Section titled “Allocate first, then fill”const rewards = new Array<Reward>(size);for (const index of $range(1, size)) { rewards[index - 1] = makeReward();}
const baseRewards = table.create(size, fallback);const mappedRewards = baseRewards.map((value) => value);Options
Section titled “Options”This rule has no options.
Related rules
Section titled “Related rules”no-array-size-assignmentChecks another array-construction pattern
prefer-sequence-overloadsCovers another Roblox-focused collection pattern
