Class LuaContextParameterBinding
Binds a product's declared Lua context parameter to a value derived from MarinerSettings. A binding pairs the declared parameter id with a factory that computes its value and a serializer that encodes that value as a Lua string literal.
public sealed record LuaContextParameterBinding : IEquatable<LuaContextParameterBinding>
- Inheritance
-
LuaContextParameterBinding
- Implements
- Inherited Members
Remarks
This is where per-product mapping policy lives — including name differences
and inversions. For example, S-101 declares FourShades while S-131
declares its inverse TwoShades; the S-131 binding expresses that as
new("TwoShades", m => !m.FourShades, LuaValueSerializers.Bool).
The generic LuaRuleExecutor applies a binding only when its
DeclaredId is present in the catalogue's declared
ContextParameters, and skips it when
ValueFactory returns null (e.g. an optional
language code that the user left blank). This keeps the engine from calling
PortrayalSetContextParameter for parameters the catalogue never
declared, which the Lua side would reject.
Constructors
LuaContextParameterBinding(string, Func<MarinerSettings, object?>, Func<object?, string>)
Binds a product's declared Lua context parameter to a value derived from MarinerSettings. A binding pairs the declared parameter id with a factory that computes its value and a serializer that encodes that value as a Lua string literal.
public LuaContextParameterBinding(string DeclaredId, Func<MarinerSettings, object?> ValueFactory, Func<object?, string> Serialize)
Parameters
DeclaredIdstringThe catalogue-declared parameter id this binding targets.
ValueFactoryFunc<MarinerSettings, object>Computes the override value from the render's settings, or returns null to leave the catalogue default in place.
SerializeFunc<object, string>Encodes the value as the Lua literal string.
Remarks
This is where per-product mapping policy lives — including name differences
and inversions. For example, S-101 declares FourShades while S-131
declares its inverse TwoShades; the S-131 binding expresses that as
new("TwoShades", m => !m.FourShades, LuaValueSerializers.Bool).
The generic LuaRuleExecutor applies a binding only when its
DeclaredId is present in the catalogue's declared
ContextParameters, and skips it when
ValueFactory returns null (e.g. an optional
language code that the user left blank). This keeps the engine from calling
PortrayalSetContextParameter for parameters the catalogue never
declared, which the Lua side would reject.
Properties
DeclaredId
The catalogue-declared parameter id this binding targets.
public string DeclaredId { get; init; }
Property Value
Serialize
Encodes the value as the Lua literal string.
public Func<object?, string> Serialize { get; init; }
Property Value
ValueFactory
Computes the override value from the render's settings, or returns null to leave the catalogue default in place.
public Func<MarinerSettings, object?> ValueFactory { get; init; }