luabind-user Mailing List for luabind
Brought to you by:
arvidn,
daniel_wallin
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
(54) |
May
(66) |
Jun
(56) |
Jul
(114) |
Aug
(84) |
Sep
(20) |
Oct
(30) |
Nov
(16) |
Dec
(38) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(36) |
Feb
(27) |
Mar
(32) |
Apr
(83) |
May
(66) |
Jun
(64) |
Jul
(63) |
Aug
(45) |
Sep
(14) |
Oct
(24) |
Nov
(19) |
Dec
(17) |
| 2005 |
Jan
(28) |
Feb
(20) |
Mar
(30) |
Apr
(19) |
May
(14) |
Jun
(18) |
Jul
(18) |
Aug
(6) |
Sep
(34) |
Oct
(46) |
Nov
(26) |
Dec
(44) |
| 2006 |
Jan
(41) |
Feb
(25) |
Mar
(42) |
Apr
(23) |
May
(21) |
Jun
(34) |
Jul
(44) |
Aug
(25) |
Sep
(29) |
Oct
(36) |
Nov
(7) |
Dec
(1) |
| 2007 |
Jan
(46) |
Feb
(22) |
Mar
(6) |
Apr
(10) |
May
(19) |
Jun
(20) |
Jul
|
Aug
(11) |
Sep
(33) |
Oct
(18) |
Nov
(13) |
Dec
(10) |
| 2008 |
Jan
(7) |
Feb
(6) |
Mar
(9) |
Apr
(5) |
May
(14) |
Jun
(29) |
Jul
(15) |
Aug
(10) |
Sep
(75) |
Oct
(43) |
Nov
(38) |
Dec
(40) |
| 2009 |
Jan
(62) |
Feb
(61) |
Mar
(74) |
Apr
(22) |
May
(31) |
Jun
(32) |
Jul
(32) |
Aug
(36) |
Sep
(7) |
Oct
(20) |
Nov
(51) |
Dec
(65) |
| 2010 |
Jan
(38) |
Feb
(48) |
Mar
(57) |
Apr
(21) |
May
(23) |
Jun
(41) |
Jul
(58) |
Aug
(17) |
Sep
(39) |
Oct
(15) |
Nov
(3) |
Dec
(13) |
| 2011 |
Jan
(35) |
Feb
(40) |
Mar
(17) |
Apr
(34) |
May
(39) |
Jun
(34) |
Jul
(19) |
Aug
(23) |
Sep
|
Oct
(20) |
Nov
(7) |
Dec
(12) |
| 2012 |
Jan
(13) |
Feb
(27) |
Mar
(15) |
Apr
(32) |
May
(9) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
(26) |
Oct
(4) |
Nov
(18) |
Dec
(4) |
| 2013 |
Jan
(15) |
Feb
(4) |
Mar
|
Apr
(20) |
May
(6) |
Jun
(10) |
Jul
(17) |
Aug
(6) |
Sep
(19) |
Oct
(3) |
Nov
(1) |
Dec
|
| 2014 |
Jan
(1) |
Feb
(6) |
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
(3) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(10) |
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Alan G. <ALO...@ve...> - 2016-08-22 14:13:45
|
Hey, smellysoft has released an AI adapter for Minecraft. ( https://www.microsoft.com/en-us/research/project/project-malmo/ ) It requires luabindings. Because it's kinda coolish, and this is a high-priority application for me, it therefore refuses to build on my machine because your package doesn't work. =( (Computers are machines optimized to frustrate the hell out of me.) tortoise luabind-0.9.1 # bjam --version Boost.Build 2015.07-git tortoise luabind-0.9.1 # gcc --version gcc (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. tortoise luabind-0.9.1 # bjam install warning: No toolsets are configured. warning: Configuring default toolset "gcc". warning: If the default is wrong, your build may not work correctly. warning: Use the "toolset=xxxxx" option to override our guess. warning: For more configuration options, please consult warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html ...patience... ...found 1022 targets... ...updating 12 targets... gcc.compile.c++ bin/gcc-5.4.0/debug/src/class.o In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp: In function ‘bool luabind::detail::operator==(const luabind::detail::basic_iterator<luabind::detail::basic_access>&, const luabind::detail::basic_iterator<luabind::detail::basic_access>&)’: ./luabind/object.hpp:546:37: error: no matching function for call to ‘operator==(const luabind::detail::basic_iterator<luabind::detail::basic_access>&, const luabind::detail::basic_iterator<luabind::detail::basic_access>&)’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/bind/bind.hpp:29:0, from /usr/include/boost/bind.hpp:22, from ./luabind/class.hpp:78, from src/class.cpp:30: /usr/include/boost/bind/arg.hpp:41:40: note: candidate: template<int I> bool boost::operator==(const boost::arg<I>&, const boost::arg<I>&) template< int I > BOOST_CONSTEXPR bool operator==( arg<I> const &, arg<I> const & ) ^ /usr/include/boost/bind/arg.hpp:41:40: note: template argument deduction/substitution failed: In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp:546:37: note: ‘const luabind::detail::basic_iterator<luabind::detail::basic_access>’ is not derived from ‘const boost::arg<I>’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/optional/optional.hpp:1143:0, from /usr/include/boost/optional.hpp:15, from ./luabind/object.hpp:31, from ./luabind/detail/call_member.hpp:34, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: /usr/include/boost/optional/detail/optional_relops.hpp:28:6: note: candidate: template<class T> bool boost::operator==(const boost::optional<T>&, const boost::optional<T>&) bool operator == ( optional<T> const& x, optional<T> const& y ) ^ /usr/include/boost/optional/detail/optional_relops.hpp:28:6: note: template argument deduction/substitution failed: In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp:546:37: note: ‘const luabind::detail::basic_iterator<luabind::detail::basic_access>’ is not derived from ‘const boost::optional<T>’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/optional/optional.hpp:1143:0, from /usr/include/boost/optional.hpp:15, from ./luabind/object.hpp:31, from ./luabind/detail/call_member.hpp:34, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: /usr/include/boost/optional/detail/optional_relops.hpp:62:6: note: candidate: template<class T> bool boost::operator==(const boost::optional<T>&, const T&) bool operator == ( optional<T> const& x, T const& y ) ^ /usr/include/boost/optional/detail/optional_relops.hpp:62:6: note: template argument deduction/substitution failed: In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp:546:37: note: ‘const luabind::detail::basic_iterator<luabind::detail::basic_access>’ is not derived from ‘const boost::optional<T>’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/optional/optional.hpp:1143:0, from /usr/include/boost/optional.hpp:15, from ./luabind/object.hpp:31, from ./luabind/detail/call_member.hpp:34, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: /usr/include/boost/optional/detail/optional_relops.hpp:96:6: note: candidate: template<class T> bool boost::operator==(const T&, const boost::optional<T>&) bool operator == ( T const& x, optional<T> const& y ) ^ /usr/include/boost/optional/detail/optional_relops.hpp:96:6: note: template argument deduction/substitution failed: In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp:546:37: note: ‘const luabind::detail::basic_iterator<luabind::detail::basic_access>’ is not derived from ‘const boost::optional<T>’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/optional/optional.hpp:1143:0, from /usr/include/boost/optional.hpp:15, from ./luabind/object.hpp:31, from ./luabind/detail/call_member.hpp:34, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: /usr/include/boost/optional/detail/optional_relops.hpp:131:6: note: candidate: template<class T> bool boost::operator==(const boost::optional<T>&, boost::none_t) bool operator == ( optional<T> const& x, none_t ) BOOST_NOEXCEPT ^ /usr/include/boost/optional/detail/optional_relops.hpp:131:6: note: template argument deduction/substitution failed: In file included from ./luabind/detail/call_member.hpp:34:0, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: ./luabind/object.hpp:546:37: note: ‘const luabind::detail::basic_iterator<luabind::detail::basic_access>’ is not derived from ‘const boost::optional<T>’ return boost::operator op(x, y); \ ^ ./luabind/object.hpp:556:3: note: in expansion of macro ‘LUABIND_OPERATOR_ADL_WKND’ LUABIND_OPERATOR_ADL_WKND(==) ^ In file included from /usr/include/boost/optional/optional.hpp:1143:0, from /usr/include/boost/optional.hpp:15, from ./luabind/object.hpp:31, from ./luabind/detail/call_member.hpp:34, from ./luabind/wrapper_base.hpp:31, from ./luabind/back_reference.hpp:27, from ./luabind/class.hpp:93, from src/class.cpp:30: /usr/include/boost/optional/detail/optional_relops.hpp:165:6: note: candidate: template<class T> bool boost::operator==(boost::none_t, const boost::optional<T>&) bool operator == ( none_t , optional<T> const& y ) BOOST_NOEXCEPT [many many pages omitted...] -- IQ is a measure of how stupid you feel. Powers are not rights. |
|
From: Noorul <no...@gm...> - 2016-02-11 06:47:25
|
Hi all, My question is related to http://sourceforge.net/p/luabind/mailman/message/23083724/ this thread. I am using the 0.91 version of luabind , so the solution provided in this is not matching my source . Does anybody has found any workaround to use luabind inside a plugin. Regards, Noorul |
|
From: <max...@we...> - 2016-01-25 16:02:11
|
http://mts-locks.com/service.php |
|
From: Michael S. <ms...@tu...> - 2015-12-13 13:30:38
|
Yes, I was referring to the use of the class functionality without a c++ base class. Am 13.12.2015 um 12:53 schrieb jean-baptiste griffo: > Well they are pretty usefull if you want to inherit from a c++ class. > I'm making a game engine and these lua-class are awesome to add new > Types to the engine :) > On 12/12/2015 18:28, Michael Steinberg wrote: >> Nevermind... I will try to reproduce later. >> And I need to find out what's the use for having these lua-only >> classes... :) >> >> Am 12.12.2015 um 15:10 schrieb jean-baptiste griffo: >>> This works for me too in such a case, but it fails if the object is a >>> luabind 'class' object, as in the OP message: >>> >>> class 'MyLuaClass' >>> function MyLuaClass:__init() end >>> >>> foo = MyLuaClass() >>> foo.bar = "baz"; >>> PrintAttributes(foo); >>> >>> >>> >>> On 12/12/2015 14:48, Pavel Kovalenko wrote: >>>> This example works for me (but I use another fork: >>>> https://github.com/decimad/luabind-deboostified) >>>> >>>> lua code: >>>> >>>> local obj = {} >>>> obj.foo = function (self) >>>> puts("obj:foo") >>>> end >>>> obj.data = 42 >>>> >>>> dump_object(obj) >>>> >>>> cpp code: >>>> >>>> void dump_object(const luabind::object &obj) >>>> { >>>> for (luabind::iterator it(obj), end; it!=end; it++) >>>> { >>>> auto s = object_cast<std::string>(it.key()); >>>> puts(s.c_str()); >>>> } >>>> } >>>> >>>> What kind of lua object are you trying to iterate over? >>>> On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: >>>>> Hi, >>>>> >>>>> Well it's weird but I don't remember the exact fork I'm using, I think I >>>>> use this one >>>>> https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind >>>>> I do not use the official release because I had some problems related to >>>>> size_t & x64 builds, and this fork solved it. >>>>> >>>>> Here is the c++ code, please note that at this point I'm 100% sure the >>>>> object on the stack is the "self" of my class instance >>>>> >>>>> //get the luabind object from the stack >>>>> luabind::object o(luabind::from_stack(L, lastIndex)); >>>>> >>>>> for (luabind::iterator i(o), end; i != end; ++i) >>>>> { >>>>> try >>>>> { >>>>> std::string strKey = luabind::object_cast<std::string>(i.key()); >>>>> printf("%s\n",strKey.c_str()); >>>>> } >>>>> catch(luabind::cast_failed & e) >>>>> { >>>>> printf("error\n"); >>>>> } >>>>> } >>>>> >>>>> ---------- >>>>> >>>>> As a result, it simply prints "error" indefinitely. >>>>> >>>>> Thanks. >>>>> >>>>> >>>>> On 11/12/2015 17:57, Pavel Kovalenko wrote: >>>>>> Hi, >>>>>> >>>>>> I don't have such problem (using luabind-deboostified fork). Could you >>>>>> show the code which causes an infinite loop? Which fork do you use? >>>>>> >>>>>> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>>>>>> Send luabind-user mailing list submissions to >>>>>>> luabind-user@... >>>>>>> >>>>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>>>> or, via email, send a message with subject or body 'help' to >>>>>>> luabind-user-request@... >>>>>>> >>>>>>> You can reach the person managing the list at >>>>>>> luabind-user-owner@... >>>>>>> >>>>>>> When replying, please edit your Subject line so it is more specific >>>>>>> than "Re: Contents of luabind-user digest..." >>>>>>> >>>>>>> >>>>>>> Today's Topics: >>>>>>> >>>>>>> 1. Re: How to get the attributes of a lua class without their >>>>>>> names, using luabind (Crashy) >>>>>>> >>>>>>> >>>>>>> ---------------------------------------------------------------------- >>>>>>> >>>>>>> Message: 1 >>>>>>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>>>>>> From: Crashy <jean-baptiste.griffo@...> >>>>>>> Subject: Re: [luabind] How to get the attributes of a lua class >>>>>>> without their names, using luabind >>>>>>> To: luabind-user@... >>>>>>> Message-ID: <1449749258848-7670726.post@...> >>>>>>> Content-Type: text/plain; charset=us-ascii >>>>>>> >>>>>>> Hi ! >>>>>>> >>>>>>> I hate to 'bump' very old topics, but I'm facing the same problem while >>>>>>> writing a lua debugger. >>>>>>> I can access values by name, but using the iterator results in an infinite >>>>>>> loop. >>>>>>> Iterators are doing well when the object is a simple table though, it only >>>>>>> fails when the object is a luabind class. >>>>>>> >>>>>>> Does anybody has a solution to iterate over member variables of a luabind >>>>>>> class ? >>>>>>> >>>>>>> Thanks ! >>>>>>> >>>>>>> >>>>>>> Thibault Ehrhart wrote >>>>>>>> Hello everyone, >>>>>>>> >>>>>>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>>>>>> to get the value of the attributes defined in Lua, with C++. >>>>>>>> >>>>>>>> In the code below, I've defined a class, created an instance "foo" and set >>>>>>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>>>>>> function which has to print the attributes of the instance passed as a >>>>>>>> parameter. >>>>>>>> >>>>>>>> Here's the Lua code : >>>>>>>> >>>>>>>> class 'MyLuaClass' >>>>>>>> function MyLuaClass:__init() end >>>>>>>> >>>>>>>> foo = MyLuaClass() >>>>>>>> foo.bar = "baz"; >>>>>>>> PrintAttributes(foo); >>>>>>>> >>>>>>>> And now the C++ code of the PrintAttributes function, obj is a class >>>>>>>> instance: >>>>>>>> >>>>>>>> void PrintAttributes(luabind::object &obj) >>>>>>>> { >>>>>>>> // Direct access works >>>>>>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>>>>>> >>>>>>>> // But what if I don't know the name of the variable(s)? >>>>>>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>>>>>> { >>>>>>>> // Doesn't work since obj is an userdata >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> I've also tried to use class_info but it only works with properties >>>>>>>> defined >>>>>>>> in a C++ class. Is there a way to access those defined with Lua? >>>>>>>> >>>>>>>> Regards, >>>>>>> -- >>>>>>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>>>>>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------ >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> >>>>>>> >>>>>>> ------------------------------ >>>>>>> >>>>>>> _______________________________________________ >>>>>>> luabind-user mailing list >>>>>>> luabind-user@... >>>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>>>> >>>>>>> >>>>>>> End of luabind-user Digest, Vol 94, Issue 1 >>>>>>> ******************************************* >>>>>>> >>>>>>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> luabind-user mailing list >>> lua...@li... >>> https://lists.sourceforge.net/lists/listinfo/luabind-user >> ------------------------------------------------------------------------------ >> _______________________________________________ >> luabind-user mailing list >> lua...@li... >> https://lists.sourceforge.net/lists/listinfo/luabind-user > > ------------------------------------------------------------------------------ > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
From: jean-baptiste g. <jea...@la...> - 2015-12-13 13:13:13
|
Well they are pretty usefull if you want to inherit from a c++ class. I'm making a game engine and these lua-class are awesome to add new Types to the engine :) On 12/12/2015 18:28, Michael Steinberg wrote: > Nevermind... I will try to reproduce later. > And I need to find out what's the use for having these lua-only > classes... :) > > Am 12.12.2015 um 15:10 schrieb jean-baptiste griffo: >> This works for me too in such a case, but it fails if the object is a >> luabind 'class' object, as in the OP message: >> >> class 'MyLuaClass' >> function MyLuaClass:__init() end >> >> foo = MyLuaClass() >> foo.bar = "baz"; >> PrintAttributes(foo); >> >> >> >> On 12/12/2015 14:48, Pavel Kovalenko wrote: >>> This example works for me (but I use another fork: >>> https://github.com/decimad/luabind-deboostified) >>> >>> lua code: >>> >>> local obj = {} >>> obj.foo = function (self) >>> puts("obj:foo") >>> end >>> obj.data = 42 >>> >>> dump_object(obj) >>> >>> cpp code: >>> >>> void dump_object(const luabind::object &obj) >>> { >>> for (luabind::iterator it(obj), end; it!=end; it++) >>> { >>> auto s = object_cast<std::string>(it.key()); >>> puts(s.c_str()); >>> } >>> } >>> >>> What kind of lua object are you trying to iterate over? >>> On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: >>>> Hi, >>>> >>>> Well it's weird but I don't remember the exact fork I'm using, I think I >>>> use this one >>>> https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind >>>> I do not use the official release because I had some problems related to >>>> size_t & x64 builds, and this fork solved it. >>>> >>>> Here is the c++ code, please note that at this point I'm 100% sure the >>>> object on the stack is the "self" of my class instance >>>> >>>> //get the luabind object from the stack >>>> luabind::object o(luabind::from_stack(L, lastIndex)); >>>> >>>> for (luabind::iterator i(o), end; i != end; ++i) >>>> { >>>> try >>>> { >>>> std::string strKey = luabind::object_cast<std::string>(i.key()); >>>> printf("%s\n",strKey.c_str()); >>>> } >>>> catch(luabind::cast_failed & e) >>>> { >>>> printf("error\n"); >>>> } >>>> } >>>> >>>> ---------- >>>> >>>> As a result, it simply prints "error" indefinitely. >>>> >>>> Thanks. >>>> >>>> >>>> On 11/12/2015 17:57, Pavel Kovalenko wrote: >>>>> Hi, >>>>> >>>>> I don't have such problem (using luabind-deboostified fork). Could you >>>>> show the code which causes an infinite loop? Which fork do you use? >>>>> >>>>> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>>>>> Send luabind-user mailing list submissions to >>>>>> luabind-user@... >>>>>> >>>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>>> or, via email, send a message with subject or body 'help' to >>>>>> luabind-user-request@... >>>>>> >>>>>> You can reach the person managing the list at >>>>>> luabind-user-owner@... >>>>>> >>>>>> When replying, please edit your Subject line so it is more specific >>>>>> than "Re: Contents of luabind-user digest..." >>>>>> >>>>>> >>>>>> Today's Topics: >>>>>> >>>>>> 1. Re: How to get the attributes of a lua class without their >>>>>> names, using luabind (Crashy) >>>>>> >>>>>> >>>>>> ---------------------------------------------------------------------- >>>>>> >>>>>> Message: 1 >>>>>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>>>>> From: Crashy <jean-baptiste.griffo@...> >>>>>> Subject: Re: [luabind] How to get the attributes of a lua class >>>>>> without their names, using luabind >>>>>> To: luabind-user@... >>>>>> Message-ID: <1449749258848-7670726.post@...> >>>>>> Content-Type: text/plain; charset=us-ascii >>>>>> >>>>>> Hi ! >>>>>> >>>>>> I hate to 'bump' very old topics, but I'm facing the same problem while >>>>>> writing a lua debugger. >>>>>> I can access values by name, but using the iterator results in an infinite >>>>>> loop. >>>>>> Iterators are doing well when the object is a simple table though, it only >>>>>> fails when the object is a luabind class. >>>>>> >>>>>> Does anybody has a solution to iterate over member variables of a luabind >>>>>> class ? >>>>>> >>>>>> Thanks ! >>>>>> >>>>>> >>>>>> Thibault Ehrhart wrote >>>>>>> Hello everyone, >>>>>>> >>>>>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>>>>> to get the value of the attributes defined in Lua, with C++. >>>>>>> >>>>>>> In the code below, I've defined a class, created an instance "foo" and set >>>>>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>>>>> function which has to print the attributes of the instance passed as a >>>>>>> parameter. >>>>>>> >>>>>>> Here's the Lua code : >>>>>>> >>>>>>> class 'MyLuaClass' >>>>>>> function MyLuaClass:__init() end >>>>>>> >>>>>>> foo = MyLuaClass() >>>>>>> foo.bar = "baz"; >>>>>>> PrintAttributes(foo); >>>>>>> >>>>>>> And now the C++ code of the PrintAttributes function, obj is a class >>>>>>> instance: >>>>>>> >>>>>>> void PrintAttributes(luabind::object &obj) >>>>>>> { >>>>>>> // Direct access works >>>>>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>>>>> >>>>>>> // But what if I don't know the name of the variable(s)? >>>>>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>>>>> { >>>>>>> // Doesn't work since obj is an userdata >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> I've also tried to use class_info but it only works with properties >>>>>>> defined >>>>>>> in a C++ class. Is there a way to access those defined with Lua? >>>>>>> >>>>>>> Regards, >>>>>> >>>>>> -- >>>>>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>>>>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------ >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> >>>>>> >>>>>> ------------------------------ >>>>>> >>>>>> _______________________________________________ >>>>>> luabind-user mailing list >>>>>> luabind-user@... >>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>>> >>>>>> >>>>>> End of luabind-user Digest, Vol 94, Issue 1 >>>>>> ******************************************* >>>>>> >>>>>> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> luabind-user mailing list >> lua...@li... >> https://lists.sourceforge.net/lists/listinfo/luabind-user > > ------------------------------------------------------------------------------ > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
From: Michael S. <ms...@tu...> - 2015-12-12 18:02:59
|
Nevermind... I will try to reproduce later. And I need to find out what's the use for having these lua-only classes... :) Am 12.12.2015 um 15:10 schrieb jean-baptiste griffo: > This works for me too in such a case, but it fails if the object is a > luabind 'class' object, as in the OP message: > > class 'MyLuaClass' > function MyLuaClass:__init() end > > foo = MyLuaClass() > foo.bar = "baz"; > PrintAttributes(foo); > > > > On 12/12/2015 14:48, Pavel Kovalenko wrote: >> This example works for me (but I use another fork: >> https://github.com/decimad/luabind-deboostified) >> >> lua code: >> >> local obj = {} >> obj.foo = function (self) >> puts("obj:foo") >> end >> obj.data = 42 >> >> dump_object(obj) >> >> cpp code: >> >> void dump_object(const luabind::object &obj) >> { >> for (luabind::iterator it(obj), end; it!=end; it++) >> { >> auto s = object_cast<std::string>(it.key()); >> puts(s.c_str()); >> } >> } >> >> What kind of lua object are you trying to iterate over? >> On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: >>> Hi, >>> >>> Well it's weird but I don't remember the exact fork I'm using, I think I >>> use this one >>> https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind >>> I do not use the official release because I had some problems related to >>> size_t & x64 builds, and this fork solved it. >>> >>> Here is the c++ code, please note that at this point I'm 100% sure the >>> object on the stack is the "self" of my class instance >>> >>> //get the luabind object from the stack >>> luabind::object o(luabind::from_stack(L, lastIndex)); >>> >>> for (luabind::iterator i(o), end; i != end; ++i) >>> { >>> try >>> { >>> std::string strKey = luabind::object_cast<std::string>(i.key()); >>> printf("%s\n",strKey.c_str()); >>> } >>> catch(luabind::cast_failed & e) >>> { >>> printf("error\n"); >>> } >>> } >>> >>> ---------- >>> >>> As a result, it simply prints "error" indefinitely. >>> >>> Thanks. >>> >>> >>> On 11/12/2015 17:57, Pavel Kovalenko wrote: >>>> Hi, >>>> >>>> I don't have such problem (using luabind-deboostified fork). Could you >>>> show the code which causes an infinite loop? Which fork do you use? >>>> >>>> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>>>> Send luabind-user mailing list submissions to >>>>> luabind-user@... >>>>> >>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>> or, via email, send a message with subject or body 'help' to >>>>> luabind-user-request@... >>>>> >>>>> You can reach the person managing the list at >>>>> luabind-user-owner@... >>>>> >>>>> When replying, please edit your Subject line so it is more specific >>>>> than "Re: Contents of luabind-user digest..." >>>>> >>>>> >>>>> Today's Topics: >>>>> >>>>> 1. Re: How to get the attributes of a lua class without their >>>>> names, using luabind (Crashy) >>>>> >>>>> >>>>> ---------------------------------------------------------------------- >>>>> >>>>> Message: 1 >>>>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>>>> From: Crashy <jean-baptiste.griffo@...> >>>>> Subject: Re: [luabind] How to get the attributes of a lua class >>>>> without their names, using luabind >>>>> To: luabind-user@... >>>>> Message-ID: <1449749258848-7670726.post@...> >>>>> Content-Type: text/plain; charset=us-ascii >>>>> >>>>> Hi ! >>>>> >>>>> I hate to 'bump' very old topics, but I'm facing the same problem while >>>>> writing a lua debugger. >>>>> I can access values by name, but using the iterator results in an infinite >>>>> loop. >>>>> Iterators are doing well when the object is a simple table though, it only >>>>> fails when the object is a luabind class. >>>>> >>>>> Does anybody has a solution to iterate over member variables of a luabind >>>>> class ? >>>>> >>>>> Thanks ! >>>>> >>>>> >>>>> Thibault Ehrhart wrote >>>>>> Hello everyone, >>>>>> >>>>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>>>> to get the value of the attributes defined in Lua, with C++. >>>>>> >>>>>> In the code below, I've defined a class, created an instance "foo" and set >>>>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>>>> function which has to print the attributes of the instance passed as a >>>>>> parameter. >>>>>> >>>>>> Here's the Lua code : >>>>>> >>>>>> class 'MyLuaClass' >>>>>> function MyLuaClass:__init() end >>>>>> >>>>>> foo = MyLuaClass() >>>>>> foo.bar = "baz"; >>>>>> PrintAttributes(foo); >>>>>> >>>>>> And now the C++ code of the PrintAttributes function, obj is a class >>>>>> instance: >>>>>> >>>>>> void PrintAttributes(luabind::object &obj) >>>>>> { >>>>>> // Direct access works >>>>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>>>> >>>>>> // But what if I don't know the name of the variable(s)? >>>>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>>>> { >>>>>> // Doesn't work since obj is an userdata >>>>>> } >>>>>> } >>>>>> >>>>>> I've also tried to use class_info but it only works with properties >>>>>> defined >>>>>> in a C++ class. Is there a way to access those defined with Lua? >>>>>> >>>>>> Regards, >>>>> >>>>> >>>>> -- >>>>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>>>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>>>> >>>>> >>>>> >>>>> ------------------------------ >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> >>>>> >>>>> ------------------------------ >>>>> >>>>> _______________________________________________ >>>>> luabind-user mailing list >>>>> luabind-user@... >>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>> >>>>> >>>>> End of luabind-user Digest, Vol 94, Issue 1 >>>>> ******************************************* >>>>> >>>>> > > ------------------------------------------------------------------------------ > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
From: Michael S. <ms...@tu...> - 2015-12-12 17:50:56
|
Is this pseudo-code or are you missing to specify a base class? Am 12.12.2015 um 15:10 schrieb jean-baptiste griffo: > This works for me too in such a case, but it fails if the object is a > luabind 'class' object, as in the OP message: > > class 'MyLuaClass' > function MyLuaClass:__init() end > > foo = MyLuaClass() > foo.bar = "baz"; > PrintAttributes(foo); > > > > On 12/12/2015 14:48, Pavel Kovalenko wrote: >> This example works for me (but I use another fork: >> https://github.com/decimad/luabind-deboostified) >> >> lua code: >> >> local obj = {} >> obj.foo = function (self) >> puts("obj:foo") >> end >> obj.data = 42 >> >> dump_object(obj) >> >> cpp code: >> >> void dump_object(const luabind::object &obj) >> { >> for (luabind::iterator it(obj), end; it!=end; it++) >> { >> auto s = object_cast<std::string>(it.key()); >> puts(s.c_str()); >> } >> } >> >> What kind of lua object are you trying to iterate over? >> On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: >>> Hi, >>> >>> Well it's weird but I don't remember the exact fork I'm using, I think I >>> use this one >>> https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind >>> I do not use the official release because I had some problems related to >>> size_t & x64 builds, and this fork solved it. >>> >>> Here is the c++ code, please note that at this point I'm 100% sure the >>> object on the stack is the "self" of my class instance >>> >>> //get the luabind object from the stack >>> luabind::object o(luabind::from_stack(L, lastIndex)); >>> >>> for (luabind::iterator i(o), end; i != end; ++i) >>> { >>> try >>> { >>> std::string strKey = luabind::object_cast<std::string>(i.key()); >>> printf("%s\n",strKey.c_str()); >>> } >>> catch(luabind::cast_failed & e) >>> { >>> printf("error\n"); >>> } >>> } >>> >>> ---------- >>> >>> As a result, it simply prints "error" indefinitely. >>> >>> Thanks. >>> >>> >>> On 11/12/2015 17:57, Pavel Kovalenko wrote: >>>> Hi, >>>> >>>> I don't have such problem (using luabind-deboostified fork). Could you >>>> show the code which causes an infinite loop? Which fork do you use? >>>> >>>> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>>>> Send luabind-user mailing list submissions to >>>>> luabind-user@... >>>>> >>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>> or, via email, send a message with subject or body 'help' to >>>>> luabind-user-request@... >>>>> >>>>> You can reach the person managing the list at >>>>> luabind-user-owner@... >>>>> >>>>> When replying, please edit your Subject line so it is more specific >>>>> than "Re: Contents of luabind-user digest..." >>>>> >>>>> >>>>> Today's Topics: >>>>> >>>>> 1. Re: How to get the attributes of a lua class without their >>>>> names, using luabind (Crashy) >>>>> >>>>> >>>>> ---------------------------------------------------------------------- >>>>> >>>>> Message: 1 >>>>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>>>> From: Crashy <jean-baptiste.griffo@...> >>>>> Subject: Re: [luabind] How to get the attributes of a lua class >>>>> without their names, using luabind >>>>> To: luabind-user@... >>>>> Message-ID: <1449749258848-7670726.post@...> >>>>> Content-Type: text/plain; charset=us-ascii >>>>> >>>>> Hi ! >>>>> >>>>> I hate to 'bump' very old topics, but I'm facing the same problem while >>>>> writing a lua debugger. >>>>> I can access values by name, but using the iterator results in an infinite >>>>> loop. >>>>> Iterators are doing well when the object is a simple table though, it only >>>>> fails when the object is a luabind class. >>>>> >>>>> Does anybody has a solution to iterate over member variables of a luabind >>>>> class ? >>>>> >>>>> Thanks ! >>>>> >>>>> >>>>> Thibault Ehrhart wrote >>>>>> Hello everyone, >>>>>> >>>>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>>>> to get the value of the attributes defined in Lua, with C++. >>>>>> >>>>>> In the code below, I've defined a class, created an instance "foo" and set >>>>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>>>> function which has to print the attributes of the instance passed as a >>>>>> parameter. >>>>>> >>>>>> Here's the Lua code : >>>>>> >>>>>> class 'MyLuaClass' >>>>>> function MyLuaClass:__init() end >>>>>> >>>>>> foo = MyLuaClass() >>>>>> foo.bar = "baz"; >>>>>> PrintAttributes(foo); >>>>>> >>>>>> And now the C++ code of the PrintAttributes function, obj is a class >>>>>> instance: >>>>>> >>>>>> void PrintAttributes(luabind::object &obj) >>>>>> { >>>>>> // Direct access works >>>>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>>>> >>>>>> // But what if I don't know the name of the variable(s)? >>>>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>>>> { >>>>>> // Doesn't work since obj is an userdata >>>>>> } >>>>>> } >>>>>> >>>>>> I've also tried to use class_info but it only works with properties >>>>>> defined >>>>>> in a C++ class. Is there a way to access those defined with Lua? >>>>>> >>>>>> Regards, >>>>> >>>>> >>>>> -- >>>>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>>>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>>>> >>>>> >>>>> >>>>> ------------------------------ >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> >>>>> >>>>> ------------------------------ >>>>> >>>>> _______________________________________________ >>>>> luabind-user mailing list >>>>> luabind-user@... >>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>>> >>>>> >>>>> End of luabind-user Digest, Vol 94, Issue 1 >>>>> ******************************************* >>>>> >>>>> > > ------------------------------------------------------------------------------ > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
From: jean-baptiste g. <jea...@la...> - 2015-12-12 16:40:03
|
This works for me too in such a case, but it fails if the object is a luabind 'class' object, as in the OP message: class 'MyLuaClass' function MyLuaClass:__init() end foo = MyLuaClass() foo.bar = "baz"; PrintAttributes(foo); On 12/12/2015 14:48, Pavel Kovalenko wrote: > This example works for me (but I use another fork: > https://github.com/decimad/luabind-deboostified) > > lua code: > > local obj = {} > obj.foo = function (self) > puts("obj:foo") > end > obj.data = 42 > > dump_object(obj) > > cpp code: > > void dump_object(const luabind::object &obj) > { > for (luabind::iterator it(obj), end; it!=end; it++) > { > auto s = object_cast<std::string>(it.key()); > puts(s.c_str()); > } > } > > What kind of lua object are you trying to iterate over? > On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: >> Hi, >> >> Well it's weird but I don't remember the exact fork I'm using, I think I >> use this one >> https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind >> I do not use the official release because I had some problems related to >> size_t & x64 builds, and this fork solved it. >> >> Here is the c++ code, please note that at this point I'm 100% sure the >> object on the stack is the "self" of my class instance >> >> //get the luabind object from the stack >> luabind::object o(luabind::from_stack(L, lastIndex)); >> >> for (luabind::iterator i(o), end; i != end; ++i) >> { >> try >> { >> std::string strKey = luabind::object_cast<std::string>(i.key()); >> printf("%s\n",strKey.c_str()); >> } >> catch(luabind::cast_failed & e) >> { >> printf("error\n"); >> } >> } >> >> ---------- >> >> As a result, it simply prints "error" indefinitely. >> >> Thanks. >> >> >> On 11/12/2015 17:57, Pavel Kovalenko wrote: >>> Hi, >>> >>> I don't have such problem (using luabind-deboostified fork). Could you >>> show the code which causes an infinite loop? Which fork do you use? >>> >>> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>>> Send luabind-user mailing list submissions to >>>> luabind-user@... >>>> >>>> To subscribe or unsubscribe via the World Wide Web, visit >>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>> or, via email, send a message with subject or body 'help' to >>>> luabind-user-request@... >>>> >>>> You can reach the person managing the list at >>>> luabind-user-owner@... >>>> >>>> When replying, please edit your Subject line so it is more specific >>>> than "Re: Contents of luabind-user digest..." >>>> >>>> >>>> Today's Topics: >>>> >>>> 1. Re: How to get the attributes of a lua class without their >>>> names, using luabind (Crashy) >>>> >>>> >>>> ---------------------------------------------------------------------- >>>> >>>> Message: 1 >>>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>>> From: Crashy <jean-baptiste.griffo@...> >>>> Subject: Re: [luabind] How to get the attributes of a lua class >>>> without their names, using luabind >>>> To: luabind-user@... >>>> Message-ID: <1449749258848-7670726.post@...> >>>> Content-Type: text/plain; charset=us-ascii >>>> >>>> Hi ! >>>> >>>> I hate to 'bump' very old topics, but I'm facing the same problem while >>>> writing a lua debugger. >>>> I can access values by name, but using the iterator results in an infinite >>>> loop. >>>> Iterators are doing well when the object is a simple table though, it only >>>> fails when the object is a luabind class. >>>> >>>> Does anybody has a solution to iterate over member variables of a luabind >>>> class ? >>>> >>>> Thanks ! >>>> >>>> >>>> Thibault Ehrhart wrote >>>>> Hello everyone, >>>>> >>>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>>> to get the value of the attributes defined in Lua, with C++. >>>>> >>>>> In the code below, I've defined a class, created an instance "foo" and set >>>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>>> function which has to print the attributes of the instance passed as a >>>>> parameter. >>>>> >>>>> Here's the Lua code : >>>>> >>>>> class 'MyLuaClass' >>>>> function MyLuaClass:__init() end >>>>> >>>>> foo = MyLuaClass() >>>>> foo.bar = "baz"; >>>>> PrintAttributes(foo); >>>>> >>>>> And now the C++ code of the PrintAttributes function, obj is a class >>>>> instance: >>>>> >>>>> void PrintAttributes(luabind::object &obj) >>>>> { >>>>> // Direct access works >>>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>>> >>>>> // But what if I don't know the name of the variable(s)? >>>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>>> { >>>>> // Doesn't work since obj is an userdata >>>>> } >>>>> } >>>>> >>>>> I've also tried to use class_info but it only works with properties >>>>> defined >>>>> in a C++ class. Is there a way to access those defined with Lua? >>>>> >>>>> Regards, >>>> >>>> >>>> >>>> -- >>>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>>> >>>> >>>> >>>> ------------------------------ >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> >>>> ------------------------------ >>>> >>>> _______________________________________________ >>>> luabind-user mailing list >>>> luabind-user@... >>>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>>> >>>> >>>> End of luabind-user Digest, Vol 94, Issue 1 >>>> ******************************************* >>>> >>>> |
|
From: Pavel K. <pa...@ya...> - 2015-12-12 13:48:40
|
This example works for me (but I use another fork: https://github.com/decimad/luabind-deboostified) lua code: local obj = {} obj.foo = function (self) puts("obj:foo") end obj.data = 42 dump_object(obj) cpp code: void dump_object(const luabind::object &obj) { for (luabind::iterator it(obj), end; it!=end; it++) { auto s = object_cast<std::string>(it.key()); puts(s.c_str()); } } What kind of lua object are you trying to iterate over? On 12/12/2015 0:23 AM, jean-baptiste griffo wrote: > Hi, > > Well it's weird but I don't remember the exact fork I'm using, I think I > use this one > https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind > I do not use the official release because I had some problems related to > size_t & x64 builds, and this fork solved it. > > Here is the c++ code, please note that at this point I'm 100% sure the > object on the stack is the "self" of my class instance > > //get the luabind object from the stack > luabind::object o(luabind::from_stack(L, lastIndex)); > > for (luabind::iterator i(o), end; i != end; ++i) > { > try > { > std::string strKey = luabind::object_cast<std::string>(i.key()); > printf("%s\n",strKey.c_str()); > } > catch(luabind::cast_failed & e) > { > printf("error\n"); > } > } > > ---------- > > As a result, it simply prints "error" indefinitely. > > Thanks. > > > On 11/12/2015 17:57, Pavel Kovalenko wrote: >> Hi, >> >> I don't have such problem (using luabind-deboostified fork). Could you >> show the code which causes an infinite loop? Which fork do you use? >> >> On 12/11/2015 3:00 PM, luabind-user-request@... wrote: >>> Send luabind-user mailing list submissions to >>> luabind-user@... >>> >>> To subscribe or unsubscribe via the World Wide Web, visit >>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>> or, via email, send a message with subject or body 'help' to >>> luabind-user-request@... >>> >>> You can reach the person managing the list at >>> luabind-user-owner@... >>> >>> When replying, please edit your Subject line so it is more specific >>> than "Re: Contents of luabind-user digest..." >>> >>> >>> Today's Topics: >>> >>> 1. Re: How to get the attributes of a lua class without their >>> names, using luabind (Crashy) >>> >>> >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >>> From: Crashy <jean-baptiste.griffo@...> >>> Subject: Re: [luabind] How to get the attributes of a lua class >>> without their names, using luabind >>> To: luabind-user@... >>> Message-ID: <1449749258848-7670726.post@...> >>> Content-Type: text/plain; charset=us-ascii >>> >>> Hi ! >>> >>> I hate to 'bump' very old topics, but I'm facing the same problem while >>> writing a lua debugger. >>> I can access values by name, but using the iterator results in an infinite >>> loop. >>> Iterators are doing well when the object is a simple table though, it only >>> fails when the object is a luabind class. >>> >>> Does anybody has a solution to iterate over member variables of a luabind >>> class ? >>> >>> Thanks ! >>> >>> >>> Thibault Ehrhart wrote >>>> Hello everyone, >>>> >>>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>>> to get the value of the attributes defined in Lua, with C++. >>>> >>>> In the code below, I've defined a class, created an instance "foo" and set >>>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>>> function which has to print the attributes of the instance passed as a >>>> parameter. >>>> >>>> Here's the Lua code : >>>> >>>> class 'MyLuaClass' >>>> function MyLuaClass:__init() end >>>> >>>> foo = MyLuaClass() >>>> foo.bar = "baz"; >>>> PrintAttributes(foo); >>>> >>>> And now the C++ code of the PrintAttributes function, obj is a class >>>> instance: >>>> >>>> void PrintAttributes(luabind::object &obj) >>>> { >>>> // Direct access works >>>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>>> >>>> // But what if I don't know the name of the variable(s)? >>>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>>> { >>>> // Doesn't work since obj is an userdata >>>> } >>>> } >>>> >>>> I've also tried to use class_info but it only works with properties >>>> defined >>>> in a C++ class. Is there a way to access those defined with Lua? >>>> >>>> Regards, >>> >>> >>> >>> >>> -- >>> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >>> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >>> >>> >>> >>> ------------------------------ >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> ------------------------------ >>> >>> _______________________________________________ >>> luabind-user mailing list >>> luabind-user@... >>> https://lists.sourceforge.net/lists/listinfo/luabind-user >>> >>> >>> End of luabind-user Digest, Vol 94, Issue 1 >>> ******************************************* >>> >>> > -- Best regards, Pavel Kovalenko. |
|
From: jean-baptiste g. <jea...@la...> - 2015-12-12 00:23:17
|
Hi, Well it's weird but I don't remember the exact fork I'm using, I think I use this one https://github.com/mrsharpoblunto/LHP/tree/master/luabind-0.7/include/luabind I do not use the official release because I had some problems related to size_t & x64 builds, and this fork solved it. Here is the c++ code, please note that at this point I'm 100% sure the object on the stack is the "self" of my class instance //get the luabind object from the stack luabind::object o(luabind::from_stack(L, lastIndex)); for (luabind::iterator i(o), end; i != end; ++i) { try { std::string strKey = luabind::object_cast<std::string>(i.key()); printf("%s\n",strKey.c_str()); } catch(luabind::cast_failed & e) { printf("error\n"); } } ---------- As a result, it simply prints "error" indefinitely. Thanks. On 11/12/2015 17:57, Pavel Kovalenko wrote: > Hi, > > I don't have such problem (using luabind-deboostified fork). Could you > show the code which causes an infinite loop? Which fork do you use? > > On 12/11/2015 3:00 PM, lua...@li... wrote: >> Send luabind-user mailing list submissions to >> lua...@li... >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.sourceforge.net/lists/listinfo/luabind-user >> or, via email, send a message with subject or body 'help' to >> lua...@li... >> >> You can reach the person managing the list at >> lua...@li... >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of luabind-user digest..." >> >> >> Today's Topics: >> >> 1. Re: How to get the attributes of a lua class without their >> names, using luabind (Crashy) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) >> From: Crashy <jea...@la...> >> Subject: Re: [luabind] How to get the attributes of a lua class >> without their names, using luabind >> To: lua...@li... >> Message-ID: <144...@n2...> >> Content-Type: text/plain; charset=us-ascii >> >> Hi ! >> >> I hate to 'bump' very old topics, but I'm facing the same problem while >> writing a lua debugger. >> I can access values by name, but using the iterator results in an infinite >> loop. >> Iterators are doing well when the object is a simple table though, it only >> fails when the object is a luabind class. >> >> Does anybody has a solution to iterate over member variables of a luabind >> class ? >> >> Thanks ! >> >> >> Thibault Ehrhart wrote >>> Hello everyone, >>> >>> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >>> to get the value of the attributes defined in Lua, with C++. >>> >>> In the code below, I've defined a class, created an instance "foo" and set >>> a custom attribute "bar" to that instance. Finally, I am calling a C++ >>> function which has to print the attributes of the instance passed as a >>> parameter. >>> >>> Here's the Lua code : >>> >>> class 'MyLuaClass' >>> function MyLuaClass:__init() end >>> >>> foo = MyLuaClass() >>> foo.bar = "baz"; >>> PrintAttributes(foo); >>> >>> And now the C++ code of the PrintAttributes function, obj is a class >>> instance: >>> >>> void PrintAttributes(luabind::object &obj) >>> { >>> // Direct access works >>> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >>> >>> // But what if I don't know the name of the variable(s)? >>> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >>> { >>> // Doesn't work since obj is an userdata >>> } >>> } >>> >>> I've also tried to use class_info but it only works with properties >>> defined >>> in a C++ class. Is there a way to access those defined with Lua? >>> >>> Regards, >> >> >> >> >> -- >> View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html >> Sent from the Lua C++ Bind mailing list archive at Nabble.com. >> >> >> >> ------------------------------ >> >> ------------------------------------------------------------------------------ >> >> >> ------------------------------ >> >> _______________________________________________ >> luabind-user mailing list >> lua...@li... >> https://lists.sourceforge.net/lists/listinfo/luabind-user >> >> >> End of luabind-user Digest, Vol 94, Issue 1 >> ******************************************* >> >> |
|
From: Abhijit N. <abh...@gm...> - 2015-12-11 17:39:11
|
Hi, I am currently using the original luabind from Rasterbar at https://github.com/luabind/luabind Its been upgraded for Lua 5.3. I use the object oriented system in Lua that Luabind exposes(the 'class' keyword) Its working properly except that I can't get the super class of a class defined in Lua. Has anyone tried this? Currently I solve this by having all class creation & derivation go through my own function so I can track types. But I am wondering if this information is already there. e.g. class 'A' function A:__init() end class 'B'(A) function B:__init() end How to get the super class for B, i.e. A? Thanks Abhijit |
|
From: Pavel K. <pa...@ya...> - 2015-12-11 16:58:00
|
Hi, I don't have such problem (using luabind-deboostified fork). Could you show the code which causes an infinite loop? Which fork do you use? On 12/11/2015 3:00 PM, lua...@li... wrote: > Send luabind-user mailing list submissions to > lua...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/luabind-user > or, via email, send a message with subject or body 'help' to > lua...@li... > > You can reach the person managing the list at > lua...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of luabind-user digest..." > > > Today's Topics: > > 1. Re: How to get the attributes of a lua class without their > names, using luabind (Crashy) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 10 Dec 2015 05:07:38 -0700 (MST) > From: Crashy <jea...@la...> > Subject: Re: [luabind] How to get the attributes of a lua class > without their names, using luabind > To: lua...@li... > Message-ID: <144...@n2...> > Content-Type: text/plain; charset=us-ascii > > Hi ! > > I hate to 'bump' very old topics, but I'm facing the same problem while > writing a lua debugger. > I can access values by name, but using the iterator results in an infinite > loop. > Iterators are doing well when the object is a simple table though, it only > fails when the object is a luabind class. > > Does anybody has a solution to iterate over member variables of a luabind > class ? > > Thanks ! > > > Thibault Ehrhart wrote >> Hello everyone, >> >> I have a Lua class (defined using luabind's 'class' keyword) and I'd like >> to get the value of the attributes defined in Lua, with C++. >> >> In the code below, I've defined a class, created an instance "foo" and set >> a custom attribute "bar" to that instance. Finally, I am calling a C++ >> function which has to print the attributes of the instance passed as a >> parameter. >> >> Here's the Lua code : >> >> class 'MyLuaClass' >> function MyLuaClass:__init() end >> >> foo = MyLuaClass() >> foo.bar = "baz"; >> PrintAttributes(foo); >> >> And now the C++ code of the PrintAttributes function, obj is a class >> instance: >> >> void PrintAttributes(luabind::object &obj) >> { >> // Direct access works >> std::cout << obj["bar"] << std::endl; // Will print "baz" :-) >> >> // But what if I don't know the name of the variable(s)? >> for (luabind::iterator it(obj); it != luabind::iterator(); ++it) >> { >> // Doesn't work since obj is an userdata >> } >> } >> >> I've also tried to use class_info but it only works with properties >> defined >> in a C++ class. Is there a way to access those defined with Lua? >> >> Regards, > > > > > > -- > View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html > Sent from the Lua C++ Bind mailing list archive at Nabble.com. > > > > ------------------------------ > > ------------------------------------------------------------------------------ > > > ------------------------------ > > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user > > > End of luabind-user Digest, Vol 94, Issue 1 > ******************************************* > > -- Best regards, Pavel Kovalenko. |
|
From: Crashy <jea...@la...> - 2015-12-10 12:07:50
|
Hi !
I hate to 'bump' very old topics, but I'm facing the same problem while
writing a lua debugger.
I can access values by name, but using the iterator results in an infinite
loop.
Iterators are doing well when the object is a simple table though, it only
fails when the object is a luabind class.
Does anybody has a solution to iterate over member variables of a luabind
class ?
Thanks !
Thibault Ehrhart wrote
> Hello everyone,
>
> I have a Lua class (defined using luabind's 'class' keyword) and I'd like
> to get the value of the attributes defined in Lua, with C++.
>
> In the code below, I've defined a class, created an instance "foo" and set
> a custom attribute "bar" to that instance. Finally, I am calling a C++
> function which has to print the attributes of the instance passed as a
> parameter.
>
> Here's the Lua code :
>
> class 'MyLuaClass'
> function MyLuaClass:__init() end
>
> foo = MyLuaClass()
> foo.bar = "baz";
> PrintAttributes(foo);
>
> And now the C++ code of the PrintAttributes function, obj is a class
> instance:
>
> void PrintAttributes(luabind::object &obj)
> {
> // Direct access works
> std::cout << obj["bar"] << std::endl; // Will print "baz" :-)
>
> // But what if I don't know the name of the variable(s)?
> for (luabind::iterator it(obj); it != luabind::iterator(); ++it)
> {
> // Doesn't work since obj is an userdata
> }
> }
>
> I've also tried to use class_info but it only works with properties
> defined
> in a C++ class. Is there a way to access those defined with Lua?
>
> Regards,
--
View this message in context: http://lua.2524044.n2.nabble.com/How-to-get-the-attributes-of-a-lua-class-without-their-names-using-luabind-tp7654070p7670726.html
Sent from the Lua C++ Bind mailing list archive at Nabble.com.
|
|
From: Pavel K. <pa...@ya...> - 2015-11-29 20:59:01
|
Hello! Have anybody got out_value policy working? Seems it was broken a long time ago. -- Best regards, Pavel Kovalenko. |
|
From: Nitin J. <nit...@sa...> - 2015-11-24 08:02:58
|
<html><head><title>Samsung Enterprise Portal mySingle</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style id="mysingle_style" type="text/css">P {
MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
TD {
MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
LI {
MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
BODY {
FONT-SIZE: 9pt; FONT-FAMILY: Arial, arial; MARGIN: 10px; LINE-HEIGHT: 1.4
}
</style>
<meta http-equiv="X-UA-Compatible" content="IE=5">
<meta http-equiv="X-UA-Compatible" content="IE=5">
<meta name="GENERATOR" content="MSHTML 10.00.9200.17556"></head>
<body>
<p>Hi users,</p>
<p>I have found a Memory leak issue in luabind :</p>
<p> </p>
<p>In file ./luabind/detail/instance_holder.hpp </p>
<p>template <class T><br>void release_ownership(std::auto_ptr<T>& p)<br>{<br> p.release();<br>}<br></p>
<p>Here p.release() returns a pointer which is getting leak.</p>
<p>Please look into the issue and share your important views.</p>
<p> </p>
<p>Thanks!!!</p>
<table id="confidentialsignimg">
<tbody>
<tr>
<td namo_lock="">
<p><img src="cid:A6X...@na..." border="0"></p></td></tr></tbody></table></body></html><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=d1c4c6a24968fb25e081ece56311f69730bef5bb275412ced7958ea385bb4703d0394d49cb338082f1bc9e894f4f495bed2705d6268c6898dd8aaa5ed8b0e8e4326bbdfb2ea96a2fcf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'> |
|
From: Abhijit N. <abh...@gm...> - 2015-10-16 08:54:31
|
Hi, Lua does not allow the assignment operator to be overloaded and has no meta function for it. I have got around this by using the proxy pattern and the __index/__newindex meta methods. Now I have begun using classes defined via luabind's object oriented system thats exposed to Lua. I am wondering if the C++ code for Luabind can be changed to allow the assignment operator to be overloaded without changing the code for the Lua interpretor itself. Perhaps such a overload would call into a new meta-method name thats not used by Lua such as '__assign()' This would not conflict with any meta method that Lua already uses and would apply only to instances of luabind classes. I am guessing that the luabind::adl::object class needs to be changed, or perhaps index_proxy. But I am not sufficiently familiar with how luabind forwards calls to existing Lua meta-methods, to its objects. Has anyone explored the C++ code in luabind that supports operator overloading in Lua? Edit: I see some attempts to add a new operator here: https://github.com/decimad/luabind-deboostified/commit/55b1bd9217205253b41ab7d4746637ee5b0d276f If I try the above with the assignment operator though, I do no see it getting called in Lua. Are there any other changes needed in C++ for this? http://stackoverflow.com/questions/33141507/adding-an-overload-for-the-assignment-operator-in-lua-for-luabind-classes Thanks, Abhi |
|
From: Baojiang S. <sho...@gm...> - 2015-06-12 13:49:25
|
Hi guys, I have an question in reading luabind code. At the bottom of file
make_function.hpp is the definitions of two function:
template <class F, class Signature, class Policies>
object make_function(lua_State* L, F f, Signature, Policies)
{
typedef typename detail::as_vector<Signature>::type signature;
return detail::make_function_aux(
L
, new detail::function_object_impl<F, signature, Policies>(
f, Policies()
)
);
}
template <class F>
object make_function(lua_State* L, F f)
{
return make_function(L, detail::deduce_signature(f), detail::null_type());
}
In the statement make_function(L, detail::deduce_signature(f),
detail::null_type()) which only provide three args, but the above
make_function need four args. Why?
|
|
From: Сергей В. <iva...@gm...> - 2015-04-01 11:22:48
|
Why luabind can't use this function? C++ code: Vector3f createVector3f ( float x, float y, float z ); Lua Code: function UiControl:setScale ( value ) log ( "UiControl:setScale: " .. value ) local s = createVector3f ( value, value, 1 ) --error self.mesh:setScale ( s ) self.mesh:update () end Output: UiControl:setScale: 1 No matching overload found, candidates: Vector3f createVector3f(custom [f],custom [f],custom [f]) I know, this code works: local s = createVector3f ( 1, 1, 1 ) Why it doesn't when I pass an variable? Point me, please, where to dig. |
|
From: Сергей В. <iva...@gm...> - 2015-03-31 22:45:35
|
Thanks. Worked. 2015-04-01 0:41 GMT+03:00 Christian N. <cn...@gm...>: > On 2015-03-31 23:33 +0200, Сергей ВладимировичСергей Владимирович wrote: > > [...] > > > > I want to set tag for node from lua script: > > node = scene:find ( "NewGameButton" ) > > node:setTag ( "scale", value ) > > > > I get luabind error: > > No matching overload found, candidates: > > void setTag(Node&,std::string const&,std::string const&) > > > > But this line works fine > > node:setTag ( "scale", "str_value" ) > > > > How to get setTag working in both cases? > > > > It seems that value is not a string. AFAIR luabind does not implicitly > convert numbers to strings, so you should try > > node:setTag ( "scale", tostring( value ) ) > > where tostring() is a Lua standard library function > (http://www.lua.org/manual/5.1/manual.html#pdf-tostring). > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user > |
|
From: Christian N. <cn...@gm...> - 2015-03-31 21:41:17
|
On 2015-03-31 23:33 +0200, Сергей ВладимировичСергей Владимирович wrote:
> [...]
>
> I want to set tag for node from lua script:
> node = scene:find ( "NewGameButton" )
> node:setTag ( "scale", value )
>
> I get luabind error:
> No matching overload found, candidates:
> void setTag(Node&,std::string const&,std::string const&)
>
> But this line works fine
> node:setTag ( "scale", "str_value" )
>
> How to get setTag working in both cases?
>
It seems that value is not a string. AFAIR luabind does not implicitly
convert numbers to strings, so you should try
node:setTag ( "scale", tostring( value ) )
where tostring() is a Lua standard library function
(http://www.lua.org/manual/5.1/manual.html#pdf-tostring).
|
|
From: Сергей В. <iva...@gm...> - 2015-03-31 21:33:22
|
I want to pass parameters in method by reference.
class Node : public EventReceiver
{
public:
virtual void setTag ( const std::string& name, const std::string& value )
...
};
And this is luabind code to expose Node to lua:
class_<Node, EventReceiver> ( "Node" )
.def ( constructor<> () )
.def ( "setTag", &Node::setTag )
...
I want to set tag for node from lua script:
node = scene:find ( "NewGameButton" )
node:setTag ( "scale", value )
I get luabind error:
No matching overload found, candidates:
void setTag(Node&,std::string const&,std::string const&)
But this line works fine
node:setTag ( "scale", "str_value" )
How to get setTag working in both cases?
|
|
From: Daniel S. <ma...@sq...> - 2014-11-02 22:28:27
|
Just confirming that yes this fixed my real application to. Thanks a bunch.
On 1 November 2014 22:28:45 GMT+00:00, Daniel Squires <ma...@sq...> wrote:
>Brilliant thanks. I can confirm that fixes my problem, at least in the
>test case. I'll try my main app tomorrow.
>
>On 1 November 2014 19:34:42 GMT+00:00, Andreas Grob
><and...@tu...> wrote:
>>I can confirm your error with luabind 0.9.1+dfsg-8, which is what Mint
>
>>17 is using.
>>An update of libluabind and libluabind-dev to 0.9.1+dfsg-9 (from
>debian
>>
>>sid) resolves the problem.
>>
>>Regards,
>>Andreas
>>
>>Am 01.11.2014 um 19:42 schrieb ma...@sq...:
>>> oops, I had missed that out of the simplified test case, however it
>>still
>>> isn't working for me after adding that in :(.
>>>
>>> I guess lua or luabind is broken on my system (Linux Mint 17)
>>>
>>>> Hello,
>>>>
>>>> Your Lua code should not be working at all, since no libraries are
>>>> loaded and print isn't even defined.
>>>> After adding luaL_openlibs(L); after creating the Lua state, it
>>works
>>>> fine for me:
>>>>
>>>> $ ./lua
>>>> value : 4
>>>>
>>>> Regards,
>>>> Andreas
>>>>
>>>>
>>>> Am 01.11.2014 um 18:45 schrieb ma...@sq...:
>>>>> Can anybody explain this for me? It used to work on an older
>system
>>with
>>>>> lua5.1.
>>>>>
>>>>> i'm now using lua5.2, luabind version us 0.9.1 (on both systems)
>>>>>
>>>>> g++ -o lua lua.cpp -lluabind -llua5.2 -ldl -I /usr/include/lua5.2
>>>>> ./lua
>>>>> lua runtime error
>>>>> [string "function test(t)..."]:2: attempt to concatenate field
>>'value'
>>>>> (a
>>>>> function value)
>>>>>
>>>>> extern "C" {
>>>>> #include "lua.h"
>>>>> #include "lualib.h"
>>>>> #include "lauxlib.h"
>>>>> }
>>>>>
>>>>> #include <luabind/luabind.hpp>
>>>>> #include <iostream>
>>>>>
>>>>> struct Test
>>>>> {
>>>>> Test(int v) : value(v) {};
>>>>> ~Test() {};
>>>>> int value;
>>>>> };
>>>>>
>>>>>
>>>>> int DebuggerFunc(lua_State* L)
>>>>> {
>>>>> luabind::object error_msg(luabind::from_stack(L, -1));
>>>>> std::cerr << error_msg << std::endl;
>>>>> return 0;
>>>>> }
>>>>>
>>>>> int main() {
>>>>> lua_State *L = luaL_newstate();
>>>>> luabind::open(L);
>>>>>
>>>>> luabind::module(L)
>>>>> [
>>>>> luabind::class_<Test>("Test")
>>>>> .def(luabind::constructor<int>())
>>>>> .def_readonly("value",&Test::value)
>>>>> ];
>>>>>
>>>>> luaL_dostring(
>>>>> L,
>>>>> "function test(t)\n"
>>>>> " print(\"value : \" .. t.value)\n"
>>>>> "end\n"
>>>>> );
>>>>>
>>>>> Test t(4);
>>>>>
>>>>> try {
>>>>> luabind::call_function<int>(L, "test", &t);
>>>>> }
>>>>> catch (const luabind::error &er)
>>>>> {
>>>>> std::cerr << er.what() << std::endl;
>>>>> lua_State* Ler=er.state();
>>>>> DebuggerFunc(Ler);
>>>>> }
>>>>> catch (...)
>>>>> {
>>>>> std::cerr << "Unknown error!" << std::endl;
>>>>> }
>>>>> lua_close(L);
>>>>> }
>>>>>
>>>>>
>>>>>
>>------------------------------------------------------------------------------
>>>>> _______________________________________________
>>>>> luabind-user mailing list
>>>>> lua...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>>
>>>>
>>------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> luabind-user mailing list
>>>> lua...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>>
>>>
>>>
>>>
>>------------------------------------------------------------------------------
>>> _______________________________________________
>>> luabind-user mailing list
>>> lua...@li...
>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>>
>>------------------------------------------------------------------------------
>>_______________________________________________
>>luabind-user mailing list
>>lua...@li...
>>https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>--
>Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
>------------------------------------------------------------------------
>
>------------------------------------------------------------------------------
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>luabind-user mailing list
>lua...@li...
>https://lists.sourceforge.net/lists/listinfo/luabind-user
--
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
|
From: Daniel S. <ma...@sq...> - 2014-11-01 22:28:55
|
Brilliant thanks. I can confirm that fixes my problem, at least in the test case. I'll try my main app tomorrow.
On 1 November 2014 19:34:42 GMT+00:00, Andreas Grob <and...@tu...> wrote:
>I can confirm your error with luabind 0.9.1+dfsg-8, which is what Mint
>17 is using.
>An update of libluabind and libluabind-dev to 0.9.1+dfsg-9 (from debian
>
>sid) resolves the problem.
>
>Regards,
>Andreas
>
>Am 01.11.2014 um 19:42 schrieb ma...@sq...:
>> oops, I had missed that out of the simplified test case, however it
>still
>> isn't working for me after adding that in :(.
>>
>> I guess lua or luabind is broken on my system (Linux Mint 17)
>>
>>> Hello,
>>>
>>> Your Lua code should not be working at all, since no libraries are
>>> loaded and print isn't even defined.
>>> After adding luaL_openlibs(L); after creating the Lua state, it
>works
>>> fine for me:
>>>
>>> $ ./lua
>>> value : 4
>>>
>>> Regards,
>>> Andreas
>>>
>>>
>>> Am 01.11.2014 um 18:45 schrieb ma...@sq...:
>>>> Can anybody explain this for me? It used to work on an older system
>with
>>>> lua5.1.
>>>>
>>>> i'm now using lua5.2, luabind version us 0.9.1 (on both systems)
>>>>
>>>> g++ -o lua lua.cpp -lluabind -llua5.2 -ldl -I /usr/include/lua5.2
>>>> ./lua
>>>> lua runtime error
>>>> [string "function test(t)..."]:2: attempt to concatenate field
>'value'
>>>> (a
>>>> function value)
>>>>
>>>> extern "C" {
>>>> #include "lua.h"
>>>> #include "lualib.h"
>>>> #include "lauxlib.h"
>>>> }
>>>>
>>>> #include <luabind/luabind.hpp>
>>>> #include <iostream>
>>>>
>>>> struct Test
>>>> {
>>>> Test(int v) : value(v) {};
>>>> ~Test() {};
>>>> int value;
>>>> };
>>>>
>>>>
>>>> int DebuggerFunc(lua_State* L)
>>>> {
>>>> luabind::object error_msg(luabind::from_stack(L, -1));
>>>> std::cerr << error_msg << std::endl;
>>>> return 0;
>>>> }
>>>>
>>>> int main() {
>>>> lua_State *L = luaL_newstate();
>>>> luabind::open(L);
>>>>
>>>> luabind::module(L)
>>>> [
>>>> luabind::class_<Test>("Test")
>>>> .def(luabind::constructor<int>())
>>>> .def_readonly("value",&Test::value)
>>>> ];
>>>>
>>>> luaL_dostring(
>>>> L,
>>>> "function test(t)\n"
>>>> " print(\"value : \" .. t.value)\n"
>>>> "end\n"
>>>> );
>>>>
>>>> Test t(4);
>>>>
>>>> try {
>>>> luabind::call_function<int>(L, "test", &t);
>>>> }
>>>> catch (const luabind::error &er)
>>>> {
>>>> std::cerr << er.what() << std::endl;
>>>> lua_State* Ler=er.state();
>>>> DebuggerFunc(Ler);
>>>> }
>>>> catch (...)
>>>> {
>>>> std::cerr << "Unknown error!" << std::endl;
>>>> }
>>>> lua_close(L);
>>>> }
>>>>
>>>>
>>>>
>------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> luabind-user mailing list
>>>> lua...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>
>>>
>------------------------------------------------------------------------------
>>> _______________________________________________
>>> luabind-user mailing list
>>> lua...@li...
>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>
>>
>>
>>
>------------------------------------------------------------------------------
>> _______________________________________________
>> luabind-user mailing list
>> lua...@li...
>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>
>------------------------------------------------------------------------------
>_______________________________________________
>luabind-user mailing list
>lua...@li...
>https://lists.sourceforge.net/lists/listinfo/luabind-user
--
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
|
From: Andreas G. <and...@tu...> - 2014-11-01 19:34:39
|
I can confirm your error with luabind 0.9.1+dfsg-8, which is what Mint
17 is using.
An update of libluabind and libluabind-dev to 0.9.1+dfsg-9 (from debian
sid) resolves the problem.
Regards,
Andreas
Am 01.11.2014 um 19:42 schrieb ma...@sq...:
> oops, I had missed that out of the simplified test case, however it still
> isn't working for me after adding that in :(.
>
> I guess lua or luabind is broken on my system (Linux Mint 17)
>
>> Hello,
>>
>> Your Lua code should not be working at all, since no libraries are
>> loaded and print isn't even defined.
>> After adding luaL_openlibs(L); after creating the Lua state, it works
>> fine for me:
>>
>> $ ./lua
>> value : 4
>>
>> Regards,
>> Andreas
>>
>>
>> Am 01.11.2014 um 18:45 schrieb ma...@sq...:
>>> Can anybody explain this for me? It used to work on an older system with
>>> lua5.1.
>>>
>>> i'm now using lua5.2, luabind version us 0.9.1 (on both systems)
>>>
>>> g++ -o lua lua.cpp -lluabind -llua5.2 -ldl -I /usr/include/lua5.2
>>> ./lua
>>> lua runtime error
>>> [string "function test(t)..."]:2: attempt to concatenate field 'value'
>>> (a
>>> function value)
>>>
>>> extern "C" {
>>> #include "lua.h"
>>> #include "lualib.h"
>>> #include "lauxlib.h"
>>> }
>>>
>>> #include <luabind/luabind.hpp>
>>> #include <iostream>
>>>
>>> struct Test
>>> {
>>> Test(int v) : value(v) {};
>>> ~Test() {};
>>> int value;
>>> };
>>>
>>>
>>> int DebuggerFunc(lua_State* L)
>>> {
>>> luabind::object error_msg(luabind::from_stack(L, -1));
>>> std::cerr << error_msg << std::endl;
>>> return 0;
>>> }
>>>
>>> int main() {
>>> lua_State *L = luaL_newstate();
>>> luabind::open(L);
>>>
>>> luabind::module(L)
>>> [
>>> luabind::class_<Test>("Test")
>>> .def(luabind::constructor<int>())
>>> .def_readonly("value",&Test::value)
>>> ];
>>>
>>> luaL_dostring(
>>> L,
>>> "function test(t)\n"
>>> " print(\"value : \" .. t.value)\n"
>>> "end\n"
>>> );
>>>
>>> Test t(4);
>>>
>>> try {
>>> luabind::call_function<int>(L, "test", &t);
>>> }
>>> catch (const luabind::error &er)
>>> {
>>> std::cerr << er.what() << std::endl;
>>> lua_State* Ler=er.state();
>>> DebuggerFunc(Ler);
>>> }
>>> catch (...)
>>> {
>>> std::cerr << "Unknown error!" << std::endl;
>>> }
>>> lua_close(L);
>>> }
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> luabind-user mailing list
>>> lua...@li...
>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> luabind-user mailing list
>> lua...@li...
>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> luabind-user mailing list
> lua...@li...
> https://lists.sourceforge.net/lists/listinfo/luabind-user
|
|
From: <ma...@sq...> - 2014-11-01 18:42:25
|
oops, I had missed that out of the simplified test case, however it still
isn't working for me after adding that in :(.
I guess lua or luabind is broken on my system (Linux Mint 17)
> Hello,
>
> Your Lua code should not be working at all, since no libraries are
> loaded and print isn't even defined.
> After adding luaL_openlibs(L); after creating the Lua state, it works
> fine for me:
>
> $ ./lua
> value : 4
>
> Regards,
> Andreas
>
>
> Am 01.11.2014 um 18:45 schrieb ma...@sq...:
>> Can anybody explain this for me? It used to work on an older system with
>> lua5.1.
>>
>> i'm now using lua5.2, luabind version us 0.9.1 (on both systems)
>>
>> g++ -o lua lua.cpp -lluabind -llua5.2 -ldl -I /usr/include/lua5.2
>> ./lua
>> lua runtime error
>> [string "function test(t)..."]:2: attempt to concatenate field 'value'
>> (a
>> function value)
>>
>> extern "C" {
>> #include "lua.h"
>> #include "lualib.h"
>> #include "lauxlib.h"
>> }
>>
>> #include <luabind/luabind.hpp>
>> #include <iostream>
>>
>> struct Test
>> {
>> Test(int v) : value(v) {};
>> ~Test() {};
>> int value;
>> };
>>
>>
>> int DebuggerFunc(lua_State* L)
>> {
>> luabind::object error_msg(luabind::from_stack(L, -1));
>> std::cerr << error_msg << std::endl;
>> return 0;
>> }
>>
>> int main() {
>> lua_State *L = luaL_newstate();
>> luabind::open(L);
>>
>> luabind::module(L)
>> [
>> luabind::class_<Test>("Test")
>> .def(luabind::constructor<int>())
>> .def_readonly("value",&Test::value)
>> ];
>>
>> luaL_dostring(
>> L,
>> "function test(t)\n"
>> " print(\"value : \" .. t.value)\n"
>> "end\n"
>> );
>>
>> Test t(4);
>>
>> try {
>> luabind::call_function<int>(L, "test", &t);
>> }
>> catch (const luabind::error &er)
>> {
>> std::cerr << er.what() << std::endl;
>> lua_State* Ler=er.state();
>> DebuggerFunc(Ler);
>> }
>> catch (...)
>> {
>> std::cerr << "Unknown error!" << std::endl;
>> }
>> lua_close(L);
>> }
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> luabind-user mailing list
>> lua...@li...
>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> luabind-user mailing list
> lua...@li...
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
|