Re: Existence of a luabind::execute_file function ?

Teto <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Just want to make sure before starting and after consulting the pil (
http://www.lua.org/pil/25.2.html) and this page :
http://www.corsix.org/content/common-lua-pitfall-loading-code, I should push
the error handler function on the stack before loading file ( since loading
file basically embeds the file into a function and pushes it onto the
stack). Only then can I call pcall ?

So in lua:
-push error handler
-load file
-lua_pcall(L, 0,LUA_MULTRET, lua_gettop(L)-1)  ?

I could also use luabind::detail::pcall(L,1,0) so that the error handler is
"lua_inserted" under the loaded file chunk ?


Nb: Just to be sure is answer http://www.luafaq.org/#T7.6 correct ? it looks
correct to me but as it is an unofficial FAQ...

On Mon, Mar 14, 2011 at 3:43 AM, Ryan Pavlik <[email protected]> wrote:

> While it's not as elegant, you could run the string "dofile('whatever')".
>  Or, just fork Luabind on Github and add the header you'd like yourself. I'd
> find it handy too.
>
> Ryan
>
> On Sun, Mar 13, 2011 at 5:58 PM, Teto <[email protected]> wrote:
>
>> Hi,
>>
>> I started lua with luabind using it (or wanting to use it) as a C++
>> wrapper for lua. It allowed me to run my first lua script very quickly
>> (in a day) but also allowed me to avoid learning about lua inner
>> mechanisms (which was a bad thing, I had quite some difficulties to
>> getmyself learning the C api after that, I would recommand anyone to
>> start using lua without luabind and after some time to resort to
>> luabind)
>> I was wrong since many things are not possible with luabind alone. You
>> have to use lua functions. I was wondering to what extent luabind was
>> meant to complete lua. For example, is there any project to create a
>> function that replaces lua_loadfile || lua_pcall such as int
>> luabind::execute_file(const char*).
>> It would basically push the error callback function, load the file
>> chunk and then do an appropriate pcall and pop the callback function.
>> Does that go into the attribution of luabind ? or is luabind focusing
>> on binding only ?
>>
>> Regards
>>
>>
>> ------------------------------------------------------------------------------
>> Colocation vs. Managed Hosting
>> A question and answer guide to determining the best fit
>> for your organization - today and in the future.
>> http://p.sf.net/sfu/internap-sfd2d
>> _______________________________________________
>> luabind-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>
>
>
> --
> Ryan Pavlik
> HCI Graduate Student
> Virtual Reality Applications Center
> Iowa State University
>
> [email protected]
> http://academic.cleardefinition.com
> Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
>

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d

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