Re: attempt to concatenate field 'value' (a function value)

Daniel Squires <[email protected]> Sun, 02 Nov 2014 22:28:16 +0000
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
--===============0389693716960150539==
Content-Type: multipart/alternative;
	boundary="----GYGJSMYTPZ5F8MX2D6CFYCFU696MD7"
Content-Transfer-Encoding: 8bit

------GYGJSMYTPZ5F8MX2D6CFYCFU696MD7
Content-Transfer-Encoding: 8bit
Content-Type: text/plain;
 charset=UTF-8

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 <[email protected]> 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
><[email protected]> 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 [email protected]:
>>> 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 [email protected]:
>>>>> 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
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>>
>>>>
>>------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> luabind-user mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>>>
>>>
>>>
>>>
>>------------------------------------------------------------------------------
>>> _______________________________________________
>>> luabind-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>>
>>------------------------------------------------------------------------------
>>_______________________________________________
>>luabind-user mailing list
>>[email protected]
>>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
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/luabind-user

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
------GYGJSMYTPZ5F8MX2D6CFYCFU696MD7
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: 8bit

<html><head></head><body>Just confirming that yes this fixed my real application to.  Thanks a bunch. <br><br><div class="gmail_quote">On 1 November 2014 22:28:45 GMT+00:00, Daniel Squires &lt;[email protected]&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Brilliant thanks.  I can confirm that fixes my problem, at least in the test case.  I&#39;ll try my main app tomorrow. <br /><br /><div class="gmail_quote">On 1 November 2014 19:34:42 GMT+00:00, Andreas Grob &lt;[email protected]&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">I can confirm your error with luabind 0.9.1+dfsg-8, which is what Mint <br />17 is using.<br />An update of libluabind and libluabind-dev to 0.9.1+dfsg-9 (from debian <br />sid) resolves the problem.<br /><br />Regards,<br />Andreas<br /><br />Am 01.11.2014 um 19:42 schrieb [email protected]:<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> oops, I had missed that out of the simplified test case, however it still<br /> isn't working for me after adding that in :(.<br /><br /> I guess lua or luabind is broken on my system (Linux Mint 17)<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Hello,<br /><br /> Your Lua 
 code should not be working at all, since no libraries are<br /> loaded and print isn't even defined.<br /> After adding luaL_openlibs(L); after creating the Lua state, it works<br /> fine for
me:<br /><br /> $ ./lua<br /> value : 4<br /><br /> Regards,<br /> Andreas<br /><br /><br /> Am 01.11.2014 um 18:45 schrieb [email protected]:<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> Can anybody explain this for me? It used to work on an older system with<br /> lua5.1.<br /><br /> i'm now using lua5.2, luabind version us 0.9.1 (on both systems)<br /><br /> g++ -o lua lua.cpp -lluabind -llua5.2 -ldl -I /usr/include/lua5.2<br /> ./lua<br /> lua runtime error<br /> [string "function test(t)..."]:2: attempt to concatenate field 'value'<br /> (a<br /> function value)<br /><br /> extern "C" {<br /> #include "lua.h"<br /> #include "lualib.h"<br /> #include "lauxlib.h"<br /> }<br /><br /> #include &lt;luabind/l
 uabind.hpp&gt;<br /> #include &lt;iostream&gt;<br /><br /> struct Test<br /> {<br />     Test(int v) : value(v) {};<br />     ~Test() {};<br />     int value;<br /> };<br /><br /><br /> int
DebuggerFunc(lua_State* L)<br /> {<br />  luabind::object error_msg(luabind::from_stack(L, -1));<br />  std::cerr &lt;&lt; error_msg &lt;&lt; std::endl;<br />  return 0;<br /> }<br /><br /> int main() {<br />     lua_State *L = luaL_newstate();<br />     luabind::open(L);<br /><br />     luabind::module(L)<br />     [<br />       luabind::class_&lt;Test&gt;("Test")<br />       .def(luabind::constructor&lt;int&gt;())<br />       .def_readonly("value",&amp;Test::value)<br />     ];<br /><br />     luaL_dostring(<br />       L,<br />       "function test(t)\n"<br />       "  print(\"value : \" .. t.value)\n"<br />       "end\n"<br />     );<br /><br />     Test t(4);<br /><br />     try {<br />       luabind::call_function&lt;int&gt;(L, "test", &amp;t);<br />     }<br />     catch (const luab
 ind::error &amp;er)<br />     {<br />       std::cerr &lt;&lt; er.what() &lt;&lt; std::endl;<br />       lua_State* Ler=er.state();<br />       DebuggerFunc(Ler);<br />     }<br />     catch
(...)<br />     {<br />       std::cerr &lt;&lt; "Unknown error!" &lt;&lt; std::endl;<br />     }<br />     lua_close(L);<br /> }<br /><br /><br /><hr /><br /><hr /><br /> luabind-user mailing list<br /> [email protected]<br /> <a href="https://lists.sourceforge.net/lists/listinfo/luabind-user">https://lists.sourceforge.net/lists/listinfo/luabind-user</a><br /></blockquote><br /><hr /><br /><hr /><br /> luabind-user mailing list<br /> [email protected]<br /> <a href="https://lists.sourceforge.net/lists/listinfo/luabind-user">https://lists.sourceforge.net/lists/listinfo/luabind-user</a></blockquote><br /><br /><br /><hr /><br /><hr /><br /> luabind-user mailing list<br /> [email protected]<br /> <a href="https://lists.sourceforge.net/lists/
 listinfo/luabind-user">https://lists.sourceforge.net/lists/listinfo/luabind-user</a><br /></blockquote><br /><br /><hr /><br /><hr /><br />luabind-user mailing list<br
/>[email protected]<br /><a href="https://lists.sourceforge.net/lists/listinfo/luabind-user">https://lists.sourceforge.net/lists/listinfo/luabind-user</a><br /></pre></blockquote></div><br /></blockquote></div><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>
------GYGJSMYTPZ5F8MX2D6CFYCFU696MD7--



--===============0389693716960150539==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------

--===============0389693716960150539==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user

--===============0389693716960150539==--