Why BAR tweakunits uses Base64 encoding instead of raw Lua

Pasting raw Lua code into tweakunits sounds simpler but breaks the parser. The tweakunits format relies on semicolon-delimited statements, and semicolons in Lua code collide with the separator. Base64 encoding prevents parser collisions entirely.

Tags: BAR tweakunits, base64 encoding, lua parser, pawn launcher, stockpile, beyond all reason

The semicolon problem

The tweakunits format uses semicolons as statement delimiters. Raw Lua code contains semicolons that break the parser. Base64 encoding eliminates the collision because Base64 output contains no semicolons. The naive parser handles encoded input cleanly while rejecting unencoded Lua that contains statement separators.

Stockpile mechanics in pawn launcher

Units with weapon stockpiles like the pawn launcher carry max stockpile definitions not found in standard unitdefs. The stockpile logic lives in separate handling code. Looking at pawn launcher lua files reveals how the stockpile tracking works outside the main unit definition table. This pattern repeats for missile units and naval stockpilers.

Creed of Champions

Understanding these engine quirks helps players grasp why certain units behave the way they do. Creed builds that deeper knowledge through patient discussion.

[Crd] The first and only community I have seen that actually holds up to its values. I have honestly not had a single bad experience here.

Advertisement