Re: [luabind] attempt to concatenate field 'value' (a function value)
Brought to you by:
arvidn,
daniel_wallin
|
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
|