[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Wrapping "Classes" seamlessly
- From: jdarling@...
- Date: Mon, 15 May 2006 11:33:41 -0700
I've worked up quite a few object wrappers for my applications, and have
run into a common problem with all. If I want to create a new
descendent from the object I get errors back when trying to call the
methods.
My solution to this is to create a new "Class" in Lua and embed the
wrapped class into it. This works fine, except that I have to create
wrapper methods for each method and property that exists in my new
version. Can anyone give me some quick pointers to how to setup my
MetaTable to manage this for me? I'd like something like a fall
through where if the method/property doesn't exist or isn't found in
the new version it falls back to the wrapped type.
Also does anyone know how hard it is to overload/override the default
require's handler? I'd like to be able to redirect require and
dofile when editing the scripts so that if a modified version exists
in memory it is used over the one on disk.
- Jeremy
"Help I suffer from the oxymoron Corporate Security."