Re: Calling class methods

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1270987303.4158.4.camel@finwe>
I just gave it a go, and it worked... Looking at your code:

pcall(App.openDatabase, app, database)

I noticed a difference to what I tried.  Try this:

pcall(app.openDatabase, app, database)

In other words use the instance for specifying the method, rather than
the class itself.

Nigel

On Fri, 2010-04-09 at 17:48 +0200, Mickaël SÉRÉGÉ wrote:
> Hi,
> 
> I'm facing a problem with Lua/Luabind.
> 
> I'm binding my class App with Luabind : 
> 
> luabind::module(lua_state) [
>       luabind::class_<App>("App")
>         .def("openDatabase", &App::openDatabaseCommand)
> ];
> 
> luabind::globals(lua_state)["portfolio"] = app;
> 
> And in my Lua script, I'm calling my method like this :
> app:openDatabase(database).
> 
> At this point, there is no problem. Now i want to protect the method
> call with pcall.
> I tried : pcall(App.openDatabase, app, database), but It tells me : no
> static 'openDatabase' in class 'App'.
> I would like to know how to use pcall with binded functions ?
> 
> Thanks in advance
> 
> --------------------------
> Mickaël SÉRÉGÉ
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.