RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Button ModuleDisplay Data ModuleFilter ModuleTiles ModuleTranslate Helper

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE ExtensionsuigridSelectorUtils

Filter Module

Reusable filtering system for grid selectors - supports set filters, range filters, search text, filter locking, and active filter calculation.

Reusable filtering system for grid selectors - supports set filters, range filters, search text, filter locking, and active filter calculation.


Overview

filterModule provides a factory that creates filter management instances. Filters can be set-based (checkboxes) or range-based (min/max sliders), with support for locking, common filter detection, and a dirty-flag optimization for recalculation.

Module path: lua/ge/extensions/ui/gridSelectorUtils/filterModule.lua (loaded via require)


Exports (M)

FunctionSignatureDescription
create(createFn, commonFilters, rangeFilters, dictFilters, backendName, passesFn)Creates a filter manager instance.

Instance Methods

MethodSignatureDescription
initializeFilters(configList)Initializes filters from item data.
getFilters()Returns filter list, active filters, and locked state.
toggleFilter(propName, option)Toggles a set filter option.
updateRangeFilter(propName, min, max)Updates range filter bounds.
resetSetFilter(propName)Resets all options to enabled.
resetRangeFilter(propName)Resets range to original bounds.
clearAllFilters()Resets all filters and search text.
passesFilters(item)Tests if an item passes current filters.
getSearchText / setSearchText(text?)Get/set search text.
lockFilter(propName, options?)Locks filter options to prevent modification.
unlockFilter(propName, options?)Unlocks locked filter options.
lockFilterMode(propName, options)Sets and locks specific option values.
lockFilterModeExclusive(propName, allowedOptions)Locks all options false except specified ones.
clearLockedFilters()Removes all filter locks.

Internals

Set Filter Toggle Logic

Toggle behavior adapts based on current state:

  • All enabled → clicking one option enables only that option, disables others
  • Mixed state → clicking flips that single option
  • All disabled after toggle → resets all to enabled (prevents empty filter)
if allEnabled then
  -- Enable only clicked, disable rest
  for _, opt in ipairs(filter.options) do
    filterByProp[propName][opt] = (opt == option)
  end
else
  filterByProp[propName][option] = not currentValue
end

Filter Locking

Locked filters cannot be toggled/reset. Used when the selector is opened with pre-set constraints:

-- Lock to only show "Rally Stage" and "Rally Loop"
instance.lockFilterModeExclusive("type", {"Rally Stage", "Rally Loop"})
-- User can toggle between those two but not enable other types

Active Filter Calculation

Produces display-friendly summaries of what's filtered:

{
  propName = "system",
  displayText = "system Challenges",
  isActive = true,
  iconType = "checkmark",
  type = "set"
}

Dirty Flag Optimization

filtersDirty tracks when filters need recalculation. setupValidFilters() is only called when dirty, caching validFilters between checks.


How It Works

  1. Backend creates filter instance with a filter-creation function
  2. initializeFilters(items) scans items to discover filter options
  3. UI renders filters from getFilters() and handles user interactions
  4. toggleFilter / updateRangeFilter modify state and set dirty flag
  5. passesFilters(item) checks item against cached valid filters + search text
  6. Locked filters maintain pre-set constraints that users can't override

Additional Exports

The following exports are available but not yet documented in detail:

  • M.create

Display Data Module

Persistent display settings, favourites, and recent items manager for grid selectors.

Tiles Module

Generic tile processing framework for grid selectors - provides path routing, grouping, clustering, and special group handling.

On this page

OverviewExports (M)Instance MethodsInternalsSet Filter Toggle LogicFilter LockingActive Filter CalculationDirty Flag OptimizationHow It WorksAdditional Exports