To facilitate concatenative programming, I want LuaVec3 and LuaQuat's "set" member methods to always return `self` (unless it's specifically creating a new copy of the vec3/quat). (For the unaware you can read about concatenative/point free programming here: https://stackoverflow.com/a/5671552. If you come from a software engineering background this might be called a "pipeline", "fluent interface", "builder pattern, etc" Further, add a "tap" function for all 3 custom type metatables, which basically applies a function then returns the same object, letting you write out-of-band computations and continue the pipieline. Code: function LuaVec3:tap(f) f(self) return self end function StackVec3:tap(f) f(self) return self end function LuaQuat:tap(f) f(self) return self end Including but not limited to the following examples below. Taken verbatim from the BeamNG lua source code but modified with the following boxes highlighting the change I want. This will let me apply transformations like the following, which makes for cleaner readable code that other programmers can read, debug, and reason about easier. (This code currently isn't possible, but if the above changes are implemented it would be possible.) Currently it's not possible to implement this in the scope of a repository-legal game mod. This kind of change requires a change to the LuaVec3/LuaQuat metatable member method definitions within mathlib.lua directly, because it's not possible to modify the metatable from outside that scope, and it's not good practice to override the vanilla game libraries with custom shim code, that would be a maintenance burden and cause conflicts with other mods/code. Having this feature directly in the vec3/quat library would be much easier for me as a Lua programmer. Further it's not feasible to implement this in a third-party wrapper function as it would be unergonomic, ugly, and again a maintenance burden to continually keep it updated with the game's lua library updates. @stenyak
I'm hoping for the mathlib.lua functions to be ported to the flowgraph system too. Flowgraph uses a separate vec3 and quat library, and lacks a lot of the functionality/operators present in the main code