raw pointer in lua

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

raw pointer in lua

鸡肋
code(C++):
luabind::object_cast<bool>(m_luaObject["SetAttribute"](m_luaObject, this, strName, strValue));

m_luaObject is  luabind::object type. I call it's SetAttribute method,and pass the second parameter "this" pointer. I had register the class of "this" in the lua.
Now, I want to call some method through "this" pointer in the lua. How can I do it?

code(LUA):
function TextButton:SetAttribute(object, name, value)
         object.InternalFindUIObject("caption") -- "this" pointer, how can I user here?
end


Thanks!
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: raw pointer in lua

Nigel Atkinson-2

On Mon, January 9, 2012 11:04 pm, ���� wrote:

> code(C++):
> luabind::object_cast<bool>(m_luaObject["SetAttribute"](m_luaObject, this,
> strName, strValue));
>
> m_luaObject is luabind::object type. I call it's SetAttribute method��and
> pass the second parameter "this" pointer. I had register the class of
> "this" in the lua.
> Now, I want to call some method through "this" pointer in the lua. How can
> I do it?
>
> code(LUA):
> function TextButton:SetAttribute(object, name, value)
> object.InternalFindUIObject("caption") -- "this" pointer, how can
> I user here?
> end

You should be able to call:

 

this:method()

 

Depending on what you have registered for the class that 'this' is an instance of.

I've attached a small example.

Nigel

 

>
>
> Thanks!
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user

this.cpp (1K) Download Attachment