Re: Uncertain about luabind
Taesoo Kwon <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
I think you have two choices.
1.
struct nLuaVar
{
public:
int sender;
};
and send a pointer of nLuaVar instance to lua. In this case, you can use
def_readwrite.
or 2.
define a setter and getter function, and use .property. (see luabind
manual).
.property
On Thu, Jan 14, 2010 at 12:25 PM, Tomas Cokis <[email protected]> wrote:
>
> I'm afraid I'm still having some trouble, consider this:
>
> struct nLuaVar
> {
> public:
>
> int* sender;
> };
>
> void Raster_Lua_SetupVar(lua_State* Slate)
> {
> module(Slate)[
> class_<nLuaVar>("nLuaVar")
> .def_readwrite("sender",
> &nLuaVar::sender)
> ];
> }
>
> void Raster_Lua_LoadVar(lua_State* Slate, const char* name, int* variable)
> {
> nLuaVar newValue;
>
> newValue.sender = variable;
>
> globals(Slate)[name] = newValue;
>
> }
>
> This seems to be what should work -- A pointer in a structure registered in
> a lua module
>
> However, when I go:
>
> Raster_Lua_SetupVar(m_LuaState);
>
> Raster_Lua_LoadVar(m_LuaState, "m_size", &m_size);
>
> luaL_dofile (m_LuaState, filePath.c_str());
>
> where the lua file is
>
> -- Stuff
>
> m_size.sender = 1
>
> --More stuff
>
> Luabind reports an error at that point, and anything after that point in
> the
> luafile does not get done.
>
> Is there something I am doing wrong?
> --
> View this message in context:
> http://old.nabble.com/Uncertain-about-luabind-tp27160576p27164964.html
> Sent from the Lua C++ Bind mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user