lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On Thu, Jun 13, 2002 at 10:37:07AM +0100, Nick Trout wrote:
> > Could you not just derive your state from Luas state struct 
> and downcast?
> > Have I missed the point?
> 
> Unless I'm completely wrong (as is my wont today for some 
> reason) -- the
> lua_State which things outside of the VM know exists, is what 
> is known as an
> "opaque type" in that we know a lua_State is a struct, and we 
> always deal in
> pointers to it.

You are right. It was a silly idea :-)

Aggregation would be a better way to do it anyway and have reflective
pointer. If you are using Lua 4.0 then you'd have to modify the code, if you
are using 5.0 I think you just change a define to add data to the state. I
assume Alex is using 4.0 then.

> Also I'm not completely convinced that C++ allows you to 
> inherit a class
> from a struct, although I could be wrong there too.

A struct in C++ is exactly the same as a class except the default access is
public, not private.

N