Table-slice and token-sequence helpers used heavily by the OpenOS shell parser.
- Repository:
opencomputers - System:
openos - Type:
library
OpenComputers/src\main\resources\assets\opencomputers\loot\openos\lib\transforms.lua
local transforms = require("transforms")- Description: Return whether a table range begins with another indexed sequence.
- Parameters:
tbl: Source indexed table to inspect.v: Indexed sequence that should match the beginning of the range.f: Optional first index of the range to test.l: Optional last index of the range to test.
transforms.begins(tokens, {'--'})- Description: Concatenate multiple indexed tables into one result table, preserving a packed
nfield when present. - Parameters:
...: Any number of indexed tables to append in order.
local merged = transforms.concat(args, extra)- Description: Find the first element or subrange that satisfies a predicate or one of several candidate token sequences.
- Parameters:
tbl: Indexed table to scan.pred: Predicate function, or a table of candidate indexed sequences.f: Optional first index to scan.l: Optional last index to scan.
local i = transforms.first(words, function(part) return part == '|' end)- The base module exposes a small core; additional helpers such as
partitionandforeachare attached lazily fromfull_transforms.