[Top][All Lists]

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

[Libqtlua-list] Implementing domain model classes/tables in Lua

From: Gustavo de Sá Carvalho Honorato
Subject: [Libqtlua-list] Implementing domain model classes/tables in Lua
Date: Mon, 17 Jan 2011 20:20:55 -0200


I've mentioned in previous e-mails that I would like to implement the
bussiness logic of my application using Lua language because of its
facilities. However, I would like to access my model classes in Lua
and C++ in an easy way for both sides. One idea I have for doing this
is to create wrappers in C++ which delegates all getters/setters and
methods to the Lua table stored in a Value object inside my wrapper
class, but I'm having some doubts:

1) Do you think that creating this wrappers/delegators is a good
approach? Any suggestions?
2) What is the difference between Value and ValueRef? I suspect that
Value is a copy of a Lua data, so, if I change something in a Value
object using C++ code it won't reflect in Lua VM. Using ValueRef it
will reflect. In this manner, the correct way to implement my wrappers
is using ValueRef, right?
3) I've started to implement this approach (source in, but I'm stuck with an error. In line
62, when I try to read the table size property with  return
value["size"]; I'm getting the following error: "Can not make value
reference with lua::nil type as table.". Could you help me?

Thanks again,

reply via email to

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