Reputation: 1
I've been trying to wrap my head around utilizing inheritance with Lua (https://www.lua.org/pil/16.2.html and Case insensitive array in Lua as references) but also integrating a case-insensitive solution, too. Namely using metatables/metamethod calls to intercept __index and __newindex, lowercasing the calls, and then proceeding.
However, I've been unable to get anything working. Can anyone help? Thanks.
In case the question arises on what I'm trying to achieve:
Create a function that uses (or creates) a base object, apply case-insensitive functionality, setup inheritance functionality, and use the base object for core functions.
From here, create mixins table (with case-insensitive functionality and inheritance off of base) for the purpose of shared functions (and can be added to, base.mixins or child.mixins) or called directly in case any child object has modified functions of same name, the shared can still be called via child.mixins.func, respectively.
Child functions (modules) are created off of the mixins table (case-insensitive functionality and inheritance). Can directly call any shared functions via child.mixins.func or add to mixins table. Ideally, the base table would be inaccessible from the child for manipulation, though core functions could still be called by inheritance (lofty goal?)
In any case, some responders may shred my query to bits, so be gentle please.
Upvotes: 0
Views: 39