Skip to content

[Tool] Add ObjectDB splitting tool - #2362

Draft
NORPG wants to merge 3 commits into
ATTWoWAddon:masterfrom
NORPG:splitDB
Draft

[Tool] Add ObjectDB splitting tool#2362
NORPG wants to merge 3 commits into
ATTWoWAddon:masterfrom
NORPG:splitDB

Conversation

@NORPG

@NORPG NORPG commented Mar 18, 2026

Copy link
Copy Markdown
Member

Summary

  • add a standalone Node.js tool for splitting a large Lua ObjectDB into smaller range-based files
  • parse numeric [objectID] = { ... } entries from an ObjectDB-style pairs({...}) table
  • select aligned 10,000-, 1,000-, or 100-ID ranges while keeping each output file at or below 700 objects
  • sort entries by object ID and write each chunk inside a generated ObjectDB assignment wrapper
  • report progress and warn when an output file contains fewer than 20 objects

Why

ObjectDB.lua is large enough to be cumbersome to manage as a single generated file. This tool produces smaller, predictably named ObjectDB modules while ensuring every parsed object ID is written exactly once.

Usage

node split_objectdb.js <input_file> [output_dir]

For example:

node split_objectdb.js ".contrib/Parser/DATAS/00 - DB/ObjectDB.lua" ./output

The output directory defaults to ./output.

Behavior and limitations

  • Only the first matching for ... in pairs({ ... }) table is parsed.
  • Only numeric entries in the form [ID] = { ... } are included; later duplicate IDs replace earlier entries.
  • Output filenames use the aligned range boundaries, such as ObjectDB_00000_09999.lua. Numeric filename ranges can overlap after narrower chunks are removed, but the IDs written to the files remain disjoint.
  • Existing generated filenames in the output directory are overwritten. Other existing files are not removed.
  • Brace matching is character-based and does not distinguish structural braces from braces inside Lua strings or comments, so the complete diff should be reviewed after running the tool.

Validation

  • Confirmed the script parses successfully with node --check split_objectdb.js.
  • Ran the tool against .contrib/Parser/DATAS/00 - DB/ObjectDB.lua: 22,898 objects were split into 120 files.
  • Re-scanned all generated files and confirmed 22,898 unique object IDs with no missing or duplicate IDs.
  • Confirmed all 120 generated files parse successfully with luac -p.

@NORPG NORPG self-assigned this Mar 18, 2026
@NORPG
NORPG requested review from DFortun81, Eremeir and ImUnicke March 18, 2026 20:06
@NORPG NORPG changed the title [Tool] Add a tool to Split ObjectDB [Tool] A tool for splitting large ObjectDB. Mar 18, 2026
@NORPG NORPG changed the title [Tool] A tool for splitting large ObjectDB. [Tool] Add ObjectDB splitting tool Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant