Re: problem on using shared_ptr

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Tue, Mar 02, 2010 at 04:47:33PM +0800, [email protected] wrote:
[...]
> and also i have a little script as:
> 
> function ProcessUpdate(sender)
>   prient("update!");
    ^^^^^^
This typo is the only real error I can find in your code, except for
catching the exception the wrong way.

[...]
>   try
>   {
>     luabind::object pu = luabind::globals(l)["ProcessUpdate"];
> 
>     if(luabind::type(pu)==LUA_TFUNCTION)
>     {
>      pu(sender);
>     }
>   }
>  catch (luabind::error* e)

This should be:

  catch (luabind::error const& e)

>  {
>     const char* what = e->what();
>  }

and to get a useful error message after catching the exception, you need
to get it from the Lua stack:

  char const* msg = lua_tostring(L, -1);

If you change your code like that you will get a more descriptive error.

HTH,
-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
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
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.