libqtlua-list
[Top][All Lists]
Advanced

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

[Libqtlua-list] Making a QObject instanciatable from Lua


From: Edwin Marshall
Subject: [Libqtlua-list] Making a QObject instanciatable from Lua
Date: Tue, 24 Jan 2012 01:31:03 -0600

First of all, I'm very new to lua, so if there is a more idiomatic way of accomplishing this, please let me know. Secondly, thank you for your efforts on such a great library. I'm evaluating it for use as a replacement for QtScript, and it seems to have a lot of features that QtScript doesn't, all while being quite compact.

Anyways, I'm designing a program[1] that defines basic components, such as Action, Item, and Container. For the purpose of this email, I will focus on the Container component, which has the sole purpose of containing items and applying arbitrary restrictions to its contents. Specifically, given a Container named Hand, the following restrictions would apply:
What I'd like to do is define a generic class in C++ named Container[2] which could then be accessed and instantiated in lua as a table. It seems as though UserData or UserObject is what I need. However, In addition to not seeing any example code of how to use such a defined object without first instantiating it (eg, passing an instance to lua), I'd like to find a way to do so that doesn't tightly couple QtLua to the Container class, should I decide to revert to a different binding language (Such as QtScript). My first instinct is to employee multiple inheritance, but I can't help but think this is sloppy, and that there is a cleaner way to do this.

In short, my question is this:
[1] http://www.assembla.com/spaces/virtual-cardgame-engine/tab_tool
[2] http://www.assembla.com/spaces/virtual-cardgame-engine/messages/1430883
--
Regards,
Edwin O Marshall (aspidites)
http://github.com/aspidites
http://bitbucket.org/aspidites
http://www.assembla.com/profile/aspidites?public=true


reply via email to

[Prev in Thread] Current Thread [Next in Thread]