Skip to content

Why Bruja

One file for the story and the logic around it.

Narrative tools are great at dialogue and awkward at logic. Scripting languages are the opposite. Bruja is both, so the inventory, the dice and the conversation live in the same place.

For narrative designers

Coming from Ink, Yarn Spinner, Ren'Py or Twine.

  • Write first. A line of dialogue is a line starting with >. Choices are indented under their question. A scene reads like a screenplay, not like code.
  • Choices that remember. Once-only * and sticky + choices, {conditions}, fallbacks, and visits("thread"), the tools Ink writers rely on.
  • Text that changes. Sequences, cycles, random picks, [count:] plurals, [and:] lists and [if:], inside any line. Dice too: 2d6.
  • Speakers and tags. @Mira (worried): says who speaks and how; #tags carry anything else your game needs.
  • Ready to ship. <b> markup and <pause> for presentation, #line: IDs for localization and voice-over, and import to split a story across files.
  • Mistakes caught early. Every error and warning before the story runs, with a line, a column, and often a one-click fix.
Start The Quest

For programmers and modders

Coming from Lua, Luau or a homemade dialogue system.

  • Lua rules, nicer syntax. Truthiness, and/or, locals, closures and globals work like Lua. Blocks are indented, arrays are 0-based, and +=, ++, ranges and switch are built in.
  • Real data types. Arrays and objects with methods, strings with methods, a math library, and typeOf().
  • Generators and events. yield makes a generator (Lua coroutines, simpler). event gives you broadcast with += and -=.
  • Localization built in. Load a CSV string table per language with SetStringTable, or plug in your own system (Unity Localization, a database) with SetLineLookup. Switch at runtime; CurrentLineId names voice-over files.
  • Embeds cleanly. Bind game functions, read and observe variables, fire events, and pull lines when you want them. Sandboxed by default: a story can only call what you give it.
  • Saves everything. One call serialises the whole state, including paused generators, and loads it back on any platform.
The Lua fast lane

Feature comparison

Based on each project's documentation as of November 2026. Spotted a mistake? Tell us.

FeatureBrujaInkYarn SpinnerRen'PyLuaLuau
Dialogue and choices are syntax YesYesYesYesNoNo
Once-only, sticky and fallback choices YesYesPartialPartialNoNo
Localization by line ID, with CSV tools YesNoYesPartialNoNo
Loops, arrays and objects YesLists onlyNoPythonTablesTables
Functions and closures YesFunctionsFrom the gamePythonYesYes
Errors before the story runs YesYesYesLintNoTypes
Save mid-scene, paused functions included YesYesVariables and nodeYesNot built inNot built in
Text variation (sequence, cycle, random, plurals, lists) 10 forms4 formsPartialNoNoNo
Text markup (bold, colour, pauses) YesNoYesYesNoNo
Stories in several files YesYesYesYesYesYes
Dice notation (2d6) YesNodice()NoNoNo
Speakers (@Mira (sad):) YesNoName:YesNoNo
Generators / coroutines GeneratorsNoNoPython, unsavedCoroutinesCoroutines
Enums YesListsNoPythonNoNo
Built-in events YesNoNoCallbacksNoNo
Unity, on Mono and IL2CPP PackageYesYesOwn engineLibrariesBindings
Web IDE YesYesYesNoDemoYes
Runtime licence MITMITMITMITMITMIT

Where the others are stronger

  • Ink has a decade of shipped games and the most mature writing tools.
  • Yarn Spinner supports Godot and Unreal today, with localisation and voice-over tooling.
  • Ren'Py is a whole visual-novel engine, with images, music, rollback and builds for desktop, mobile and the web.
  • Lua and Luau are faster, smaller and everywhere, with huge ecosystems.

Lua, but kinder.

Everything you use Lua for, with dialogue built in. The same idea in both, side by side.

Closures

Same rules as Lua: closures capture variables, not values. Arrow functions for the short ones.

Lua
local function makeCounter()
  local n = 0
  return function()
    n = n + 1
    return n
  end
end

local tick = makeCounter()
tick(); tick()
print(tick())  -- 3
Bruja
func makeCounter():
    local n = 0
    return () => ++n

tick = makeCounter()
tick(); tick()
print(tick())  // 3

Tables become arrays and objects

Arrays and objects are separate types, with methods. for k, v in obj puts the key first, like pairs().

Lua
local bag = {"rope", "lamp"}
table.insert(bag, "map")
print(#bag)  -- 3

local wolf = {name = "Grey Wolf", hp = 8}
wolf.hp = wolf.hp - 3
for k, v in pairs(wolf) do
  print(k, v)
end
Bruja
bag = ["rope", "lamp"]
bag.push("map")
print(len(bag))  // 3

wolf = {name: "Grey Wolf", hp: 8}
wolf.hp -= 3
for k, v in wolf:
    print(k, v)

Coroutines become generators

A generator is a function with yield. It works with for, and save games keep it paused mid-way.

Lua
local function patrol()
  return coroutine.wrap(function()
    coroutine.yield("the gate")
    coroutine.yield("the tower")
  end)
end

for place in patrol() do
  print("Checking " .. place)
end
Bruja
func patrol():
    yield "the gate"
    yield "the tower"

for place in patrol():
    print("Checking " + place)

Ranges, switch and compound assignment

The small things you write a hundred times a day.

Lua
for i = 1, 3 do
  gold = gold + i
end

if mood == "happy" then
  print("Smile")
elseif mood == "angry" then
  print("Frown")
else
  print("Shrug")
end
Bruja
for i in 1..3:
    gold += i

switch mood:
    case "happy":
        print("Smile")
    case "angry":
        print("Frown")
    default:
        print("Shrug")

Events instead of callback tables

Declare an event, add and remove handlers with += and -=. The game can listen and fire too.

Lua
local onDeath = {}
local function fire(list, ...)
  for _, f in ipairs(list) do f(...) end
end

table.insert(onDeath, function(name)
  print(name .. " died")
end)
fire(onDeath, "goblin")
Bruja
event died
died += name => print(name + " died")
died("goblin")