Code Monkey home page Code Monkey logo

luabind-deboostified's Issues

test_implicit_cast.cpp test fails

This unit test fails on:

void not_convertable(std::shared_ptr<A>)
{
	TEST_CHECK(false); //<----  Here!
}

But:

	// This test fails because shared_ptr-converter is broken.
	DOSTRING_EXPECTED(L,
		"a = A()\n"
		"no_convert(a)",
		("No matching overload found, candidates:\n"
		"void no_convert(custom ["
		+ std::string(typeid(std::shared_ptr<A>).name()) + "])").c_str());

Any suggestion to fix this (aka, complete this unfinished unit test)? Or just skip this step until shared_ptr converter will be fixed

Calling C++ functions with default arguments from Lua

When I try to call exported function with default args luabind says, that matching overload is not found and requires to send all arguments.
Is there a solution to use default args?

The following code working normally in the old luabind (~beta7-devel.rc4) but wont work with current version

void g_send(NET_Packet& P, bool bReliable = false, bool bSequential = true, bool bHighPriority = false, bool bSendImmediately = false)
{
     Level().Send(P, net_flags(bReliable, bSequential, bHighPriority, bSendImmediately));
}

inline static void CLevel_Export(lua_State* luaState)
{
    module(luaState, "level")
    [
        def("send", &g_send) //allow the ability to send netpacket to level
    ];
};
function exampleFunction()
    local packet = net_packet()
    ...  -- doing something with packet here
    level.send(packet); -- new luabind wants all 5 arguments
end

P.S. because of this we are forced to manually create overloads on C++ part (you can look here)

runtime error when calling lua function from C++, passing a const char*

Trying to convert from luabind(the boost version) to this one, getting error at startup.

const char* path = "..\code\script?.lua;"
luabind::call_function(_State, "set_path",path);

It seems to be trying to find the class_id for "const char", not finding anything, and then reporting that const char is not a registered class.

" Trying to use unregistered class: char const *"

Compile error VC12 (VS2013 RTM)

    luabind::module(L) [
    luabind::class_<ID3DInterface,
        std::shared_ptr<ID3DInterface>>("ID3DInterface")
];

2>libs\luabind/detail/inheritance.hpp(133): error C2440: 'static_cast': 'ID3DInterface *' cannot be converted to 'std::shared_ptr<ID3DInterface> *'.

Works in Oberon00's version.

Full error in german:

2>E:\crap\dev\prometheus\trunk\libs\luabind/detail/inheritance.hpp(133): error C2440: 'static_cast': 'ID3DInterface *' kann nicht in 'std::shared_ptr<ID3DInterface> *' konvertiert werden
2>          Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
2>          E:\crap\dev\prometheus\trunk\libs\luabind/detail/inheritance.hpp(132): Bei der Kompilierung der  Klassen-template der void *luabind::detail::static_cast_<T,Class0>::execute(void *)-Memberfunktion
2>          with
2>          [
2>              T=ID3DInterface
2>  ,            Class0=std::shared_ptr<ID3DInterface>
2>          ]
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(531): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void *luabind::detail::static_cast_<T,Class0>::execute(void *)".
2>          with
2>          [
2>              T=ID3DInterface
2>  ,            Class0=std::shared_ptr<ID3DInterface>
2>          ]
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(531): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "luabind::detail::static_cast_<T,Class0>".
2>          with
2>          [
2>              T=ID3DInterface
2>  ,            Class0=std::shared_ptr<ID3DInterface>
2>          ]
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(543): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void luabind::class_<ID3DInterface,std::shared_ptr<ID3DInterface>,luabind::detail::null_type,luabind::detail::null_type>::gen_base_info<T,>(luabind::bases<T>)".
2>          with
2>          [
2>              T=std::shared_ptr<ID3DInterface>
2>          ]
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(543): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void luabind::class_<ID3DInterface,std::shared_ptr<ID3DInterface>,luabind::detail::null_type,luabind::detail::null_type>::gen_base_info<T,>(luabind::bases<T>)".
2>          with
2>          [
2>              T=std::shared_ptr<ID3DInterface>
2>          ]
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(542): Bei der Kompilierung der  Klassen-template der void luabind::class_<ID3DInterface,std::shared_ptr<ID3DInterface>,luabind::detail::null_type,luabind::detail::null_type>::generate_baseclass_list(void)-Memberfunktion
2>          E:\crap\dev\prometheus\trunk\libs\luabind/class.hpp(508): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void luabind::class_<ID3DInterface,std::shared_ptr<ID3DInterface>,luabind::detail::null_type,luabind::detail::null_type>::generate_baseclass_list(void)".
2>          src\Base\ID3DInterface.cpp(14): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "luabind::class_<ID3DInterface,std::shared_ptr<ID3DInterface>,luabind::detail::null_type,luabind::detail::null_type>".

warning: class template partial specialization contains template parameters that can not be deduced; this partial specialization will never be used

warning: class template partial specialization contains template parameters that can not be deduced; this partial specialization will never be used
struct pop_back< type_list< Types..., TypeN > >
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I get the above warning (repeated a lot) when compiling with Clang. Not sure if it helps, but somebody had a very similar problem here: http://stackoverflow.com/questions/26081368/clang-variadic-template-specialization-error-non-deducible-template-parameter

Just to clarify the line in question is here: https://github.com/decimad/luabind-deboostified/blob/master/luabind/detail/meta.hpp#L187

Merge with Oberon00/luabind?

Hey, I would like to ask if it's possible to merge this with Oberon00's luabind fork or rpavliks merged branch. I think he got some really useful additions like the std::function converter.

Dead code warning of Coverity Scan on "luabind/detail/format_signature.hpp"

Coverity Scan results a next warning in the luabind/detail/format_signature.hpp file:

140                        lua_pushstring(L, ")");

   assignment: Assigning: sz = luabind::meta::size<luabind::meta::type_list<void, PGE_Texture const *, double, double, float, lua_State *> >::value.

141                        size_t sz = meta::size<Signature>::value;
142                        size_t ncat = sz * 2 + 2;

   const: At condition sz == 1UL, the value of sz must be equal to 6.
   dead_error_condition: The condition sz == 1UL cannot be true.

143                        if(sz == 1)

   CID 1368487 (#15 of 15): Logically dead code (DEADCODE)dead_error_line: Execution cannot reach this statement: ++ncat;.

144                                ++ncat;
145                        lua_concat(L, ncat);

Because the "Signature" type was given by template, it is possible a false positive (code is alive when template has given that "Signature" which will produce result of meta::size<Signature>::value equal to 1).

Compiler warning MSVC12 (VS2013 RTM) x64

1>luabind/detail/conversion_policies/native_converter.hpp(114): warning C4244: 'Argument': Conversion from 'const unsigned __int64' to 'lua_Number', possible loss of data
1>          src\class_info.cpp(99): See "luabind::adl::index_proxy<luabind::adl::object> luabind::adl::object::operator []<size_t>(const T &) const".
1>          with
1>          [
1>              T=size_t
1>          ]

assertion failure in object_rep::add_dependency

Although this is not specifically related to deboostifying, I considered it would be reasonable to open an issue here since it is the most active fork at the moment.

The problem was described here:

The minimal working example is provided by the author of the above topic:

I basically copy-pasted it here:

extern "C" {
#include <lualib.h>
};
#include <luabind/luabind.hpp>
#include <stdio.h>

using namespace luabind;

class Widget
{
public:
    Widget(const char* msg = "no msg", Widget* parent = nullptr) :
        msg(msg), parent(parent)
    {}
    virtual void foo() { puts("Widget::foo()"); }

    std::string msg;
    Widget* parent;
};

class WidgetWrap : public Widget, public luabind::wrap_base
{
public:
    WidgetWrap(const char* msg, Widget* parent) :
        Widget(msg, parent)
    {}
    void foo() override { call<void>("foo"); }
    static void default_foo(Widget* base) { base->Widget::foo(); }
};

int main()
{
    lua_State* L = luaL_newstate();
    luaL_openlibs(L);
    luabind::open(L);
    module(L)
    [
        class_<Widget, no_bases, default_holder, WidgetWrap>("Widget")
            .def(constructor<const char*, Widget*>())
            .def_readonly("parent", &Widget::parent)
            .def("foo", &Widget::foo, &WidgetWrap::default_foo)
    ];
    const char* code =
        "class 'MyWidget' (Widget)\n"
        "function MyWidget:__init(msg, parent)\n"
        "  Widget.__init(self, msg, parent)\n"
        "  if parent ~= nil then\n"
        "    self.parent.num = 0\n"
        "  end\n"
        "end\n"
        "function MyWidget:foo()\n"
        "  self.parent.num = self.parent.num + 1\n"
        "end\n"
        "parent = MyWidget('parent')\n"
        "child = MyWidget('child', parent)\n";
    luaL_dostring(L, code);
    auto child = object_cast<Widget*>(globals(L)["child"]);
    for (int i = 0; i < 48; i++)
        child->foo();
    return 0;
}

Multiple Return Values

Is there a specific way of handling custom return values / multiple return values with this version of luabind? So far this appears safe, but I want to double check that I'm not missing a policy or specific method of doing this:

void Test(const luabind::object& t, lua_State* L)
{
    if (luabind::type(t) == LUA_TTABLE)
    {
        const auto a = luabind::object_cast<std::string>(t["a"]);
        const auto b = luabind::object_cast<uint32_t>(t["b"]);

        // Multiple returns..
        lua_pushstring(L, a.c_str());
        lua_pushnumber(L, b);
        return;
    }

    // Multiple returns..
    lua_pushnil(L);
    lua_pushnil(L);
}

// ...

    luabind::module(L)
        [
            luabind::def("Test", &Test)
        ];
local t = { ['a'] = 'hello world', ['b'] = 1234 };
local a, b = Test(t);
print(a);
print(b);
a, b = Test(t);
print(a);
print(b);

This all seems to work fine, the stack appears to be valid and not stale with left over values etc. but I couldn't find any info in the docs around the net for Luabind on how to handle multiple values or custom pushing like this. Generally I'm used to using luabind::object as the return, something like:

luabind::object Test(const luabind::object& t, lua_State* L)
{
    return luabind::object(L, 1234);
}

But I don't think there is any proper way to return multiple values with the object.

Unit test "test_policies.cpp" fails to be build on GCC 6.3 because of "out_value_policy.hpp"

While I trying to build unit tests with CMake, the test_policies.cpp fails to be built with next error:

...

[ 92%] Built target test_extend_class_in_lua
Scanning dependencies of target test_policies
[ 93%] Building CXX object test/CMakeFiles/test_policies.dir/test_policies.cpp.o
In file included from /home/vitaly/_git_repos/luabind-deboostified-decimad/test/test_policies.cpp:26:0:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/out_value_policy.hpp: In member function ‘T& luabind::detail::pure_out_value_converter<Size, Policies>::to_cpp(lua_State*, luabind::detail::by_reference<T>, int)’:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/out_value_policy.hpp:200:46: error: wrong number of template arguments (1, should be 3)
                 storage_.template construct<T>();
                                              ^
In file included from /home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/class.hpp:83:0,
                 from /home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /home/vitaly/_git_repos/luabind-deboostified-decimad/test/test_policies.cpp:25:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/detail/constructor.hpp:51:10: note: provided for ‘template<class T, class Pointer, class Signature> struct luabind::detail::construct’
   struct construct :
          ^~~~~~~~~
In file included from /home/vitaly/_git_repos/luabind-deboostified-decimad/test/test_policies.cpp:26:0:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/out_value_policy.hpp: In member function ‘T* luabind::detail::pure_out_value_converter<Size, Policies>::to_cpp(lua_State*, luabind::detail::by_pointer<T>, int)’:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/out_value_policy.hpp:221:34: error: wrong number of template arguments (1, should be 3)
     storage_.template construct<T>();
                                  ^
In file included from /home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/class.hpp:83:0,
                 from /home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /home/vitaly/_git_repos/luabind-deboostified-decimad/test/test_policies.cpp:25:
/home/vitaly/_git_repos/luabind-deboostified-decimad/luabind/detail/constructor.hpp:51:10: note: provided for ‘template<class T, class Pointer, class Signature> struct luabind::detail::construct’
   struct construct :
          ^~~~~~~~~
test/CMakeFiles/test_policies.dir/build.make:62: recipe for target 'test/CMakeFiles/test_policies.dir/test_policies.cpp.o' failed
make[2]: *** [test/CMakeFiles/test_policies.dir/test_policies.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/test_policies.dir/all] Error 2
make: *** [all] Error 2
CMakeFiles/Makefile2:2762: recipe for target 'test/CMakeFiles/test_policies.dir/all' failed
Makefile:138: recipe for target 'all' failed

I have custom-installed GCC 6.3 via PPA on Linux Mint 18.1.

g++ (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519
Copyright (C) 2016 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.

Library itself builds fine and works with my game engine, but this unit tests fails to be built. Even I did clone of your current master state and did build: I'v got same compilation error.

I understand that I need to put two another template arguments to here (on two lines):

storage_.template construct<T, ????, ????>();

but I'm not sure which is right (I have tried to feed pointer/reference of T and "int", but that also fails)

Failed to build latest state (87897cf) on GCC 6.4.0

Just now I have tried to merge fresh changes (87897cf)with me, however, I have got a set of build errors on my side, therefore I have reverted that. I'll try to fix this later, however, if someone also will try to fix this, also greeting.

The build log (after the CMake has configured)

$ make -j 5
[  0%] Building CXX object test/CMakeFiles/test_main.dir/main.cpp.o
[  1%] Building CXX object src/CMakeFiles/luabind.dir/class_rep.cpp.o
[  1%] Building CXX object src/CMakeFiles/luabind.dir/class.cpp.o
[  2%] Building CXX object src/CMakeFiles/luabind.dir/class_registry.cpp.o
[  3%] Building CXX object src/CMakeFiles/luabind.dir/class_info.cpp.o
In file included from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_rep.cpp:29:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp: In member function ‘luabind::adl::index_proxy<Next>::this_type& luabind::adl::index_proxy<Next>::operator=(const this_type&)’:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp:75:5: error: ‘push’ is not a member of ‘luabind::detail’
     detail::push(m_interpreter, value);
     ^~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_info.cpp:27:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp: In member function ‘luabind::adl::index_proxy<Next>::this_type& luabind::adl::index_proxy<Next>::operator=(const this_type&)’:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp:75:5: error: ‘push’ is not a member of ‘luabind::detail’
     detail::push(m_interpreter, value);
     ^~~~~~
[  4%] Building CXX object src/CMakeFiles/luabind.dir/create_class.cpp.o
In file included from /.../luabind-deboostified-decimad/luabind/detail/conversion_policies/conversion_policies.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:383,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_rep.cpp:29:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp: At global scope:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp:44:10: error: specialization of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ in different namespace [-fpermissive]
   struct deduce_signature <std::function< R(Args...) >, WrappedType >
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/lua_proxy.hpp:27:0,
                 from /.../luabind-deboostified-decimad/luabind/handle.hpp:27,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:29,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_rep.cpp:29:
/.../luabind-deboostified-decimad/luabind/detail/type_traits.hpp:111:9: error:   from definition of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ [-fpermissive]
  struct deduce_signature;
         ^~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/detail/conversion_policies/conversion_policies.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:383,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_info.cpp:27:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp: At global scope:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp:44:10: error: specialization of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ in different namespace [-fpermissive]
   struct deduce_signature <std::function< R(Args...) >, WrappedType >
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/lua_proxy.hpp:27:0,
                 from /.../luabind-deboostified-decimad/luabind/handle.hpp:27,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:29,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/class_info.cpp:27:
/.../luabind-deboostified-decimad/luabind/detail/type_traits.hpp:111:9: error:   from definition of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ [-fpermissive]
  struct deduce_signature;
         ^~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/src/class.cpp:28:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp: In member function ‘luabind::adl::index_proxy<Next>::this_type& luabind::adl::index_proxy<Next>::operator=(const this_type&)’:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp:75:5: error: ‘push’ is not a member of ‘luabind::detail’
     detail::push(m_interpreter, value);
     ^~~~~~
[  5%] Linking CXX static library ../lib/libtest_main.a
src/CMakeFiles/luabind.dir/build.make:134: ошибка выполнения рецепта для цели «src/CMakeFiles/luabind.dir/class_rep.cpp.o»
make[2]: *** [src/CMakeFiles/luabind.dir/class_rep.cpp.o] Ошибка 1
make[2]: *** Ожидание завершения заданий…
[  5%] Built target test_main
In file included from /.../luabind-deboostified-decimad/luabind/detail/conversion_policies/conversion_policies.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:383,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/src/class.cpp:28:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp: At global scope:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp:44:10: error: specialization of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ in different namespace [-fpermissive]
   struct deduce_signature <std::function< R(Args...) >, WrappedType >
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/lua_proxy.hpp:27:0,
                 from /.../luabind-deboostified-decimad/luabind/handle.hpp:27,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:29,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/src/class.cpp:28:
/.../luabind-deboostified-decimad/luabind/detail/type_traits.hpp:111:9: error:   from definition of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ [-fpermissive]
  struct deduce_signature;
         ^~~~~~~~~~~~~~~~
src/CMakeFiles/luabind.dir/build.make:86: ошибка выполнения рецепта для цели «src/CMakeFiles/luabind.dir/class_info.cpp.o»
make[2]: *** [src/CMakeFiles/luabind.dir/class_info.cpp.o] Ошибка 1
In file included from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/create_class.cpp:27:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp: In member function ‘luabind::adl::index_proxy<Next>::this_type& luabind::adl::index_proxy<Next>::operator=(const this_type&)’:
/.../luabind-deboostified-decimad/luabind/lua_index_proxy.hpp:75:5: error: ‘push’ is not a member of ‘luabind::detail’
     detail::push(m_interpreter, value);
     ^~~~~~
src/CMakeFiles/luabind.dir/build.make:62: ошибка выполнения рецепта для цели «src/CMakeFiles/luabind.dir/class.cpp.o»
make[2]: *** [src/CMakeFiles/luabind.dir/class.cpp.o] Ошибка 1
In file included from /.../luabind-deboostified-decimad/luabind/detail/conversion_policies/conversion_policies.hpp:36:0,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:383,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/create_class.cpp:27:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp: At global scope:
/.../luabind-deboostified-decimad/luabind/detail/conversion_policies/function_converter.hpp:44:10: error: specialization of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ in different namespace [-fpermissive]
   struct deduce_signature <std::function< R(Args...) >, WrappedType >
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /.../luabind-deboostified-decimad/luabind/lua_proxy.hpp:27:0,
                 from /.../luabind-deboostified-decimad/luabind/handle.hpp:27,
                 from /.../luabind-deboostified-decimad/luabind/detail/object.hpp:29,
                 from /.../luabind-deboostified-decimad/luabind/make_function.hpp:9,
                 from /.../luabind-deboostified-decimad/luabind/function.hpp:8,
                 from /.../luabind-deboostified-decimad/luabind/class.hpp:81,
                 from /.../luabind-deboostified-decimad/luabind/luabind.hpp:28,
                 from /.../luabind-deboostified-decimad/src/create_class.cpp:27:
/.../luabind-deboostified-decimad/luabind/detail/type_traits.hpp:111:9: error:   from definition of ‘template<class T, class WrappedType> struct luabind::deduce_signature’ [-fpermissive]
  struct deduce_signature;

test_implicit_cast crashes gcc 4.7.3

Hi although this is not a bug in the code itself, gcc 4.7.3 crashes with the building test_implicit_cast:

[100%] Building CXX object test/CMakeFiles/test_implicit_cast.dir/test_implicit_cast.cpp.o
In file included from /home/nhoeft/projects/luabind/luabind/detail/policy.hpp:29:0,
                 from /home/nhoeft/projects/luabind/luabind/detail/convert_to_lua.hpp:28,
                 from /home/nhoeft/projects/luabind/luabind/detail/object.hpp:40,
                 from /home/nhoeft/projects/luabind/luabind/make_function.hpp:9,
                 from /home/nhoeft/projects/luabind/luabind/function.hpp:8,
                 from /home/nhoeft/projects/luabind/luabind/class.hpp:81,
                 from /home/nhoeft/projects/luabind/luabind/luabind.hpp:28,
                 from /home/nhoeft/projects/luabind/test/test_implicit_cast.cpp:24:
/home/nhoeft/projects/luabind/luabind/detail/decorate_type.hpp: In instantiation of ‘static int luabind::detail::match_struct<StackIndexList, SignatureList, End, Index>::match(lua_State*, TupleType&) [with TupleType = std::tuple<luabind::default_converter<LBENUM_t, void> >; StackIndexList = meta::index_list<1u>; SignatureList = meta::type_list<LBENUM_t, LBENUM_t>; unsigned int End = 2u; unsigned int Index = 1u; lua_State = lua_State]’:
/home/nhoeft/projects/luabind/luabind/detail/call.hpp:489:6:   required from ‘static int luabind::detail::invoke_struct<PolicyList, Signature, F>::invoke(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, F&) [with PolicyList = meta::type_list<>; Signature = meta::type_list<LBENUM_t, LBENUM_t>; F = LBENUM_t (*)(LBENUM_t); lua_State = lua_State]’
/home/nhoeft/projects/luabind/luabind/detail/call.hpp:532:76:   required from ‘int luabind::detail::invoke(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, F&) [with PolicyList = meta::type_list<>; Signature = meta::type_list<LBENUM_t, LBENUM_t>; F = LBENUM_t (*)(LBENUM_t); lua_State = lua_State]’
/home/nhoeft/projects/luabind/luabind/make_function.hpp:58:6:   required from ‘static bool luabind::detail::function_object_impl<F, Signature, InjectorList>::invoke_defer(lua_State*, luabind::detail::function_object_impl<F, Signature, InjectorList>*, luabind::detail::invoke_context&, F&, int&) [with F = LBENUM_t (*)(LBENUM_t); Signature = meta::type_list<LBENUM_t, LBENUM_t>; InjectorList = meta::type_list<>; lua_State = lua_State; luabind::detail::function_object_impl<F, Signature, InjectorList> = luabind::detail::function_object_impl<LBENUM_t (*)(LBENUM_t), meta::type_list<LBENUM_t, LBENUM_t>, meta::type_list<> >]’
/home/nhoeft/projects/luabind/luabind/make_function.hpp:79:72:   required from ‘static int luabind::detail::function_object_impl<F, Signature, InjectorList>::entry_point(lua_State*) [with F = LBENUM_t (*)(LBENUM_t); Signature = meta::type_list<LBENUM_t, LBENUM_t>; InjectorList = meta::type_list<>; lua_State = lua_State]’
/home/nhoeft/projects/luabind/luabind/make_function.hpp:33:41:   required from ‘luabind::detail::function_object_impl<F, Signature, InjectorList>::function_object_impl(F) [with F = LBENUM_t (*)(LBENUM_t); Signature = meta::type_list<LBENUM_t, LBENUM_t>; InjectorList = meta::type_list<>]’
/home/nhoeft/projects/luabind/luabind/make_function.hpp:107:161:   required from ‘luabind::adl::object luabind::make_function(lua_State*, F, meta::type_list<Types2 ...>, meta::type_list<TailTypes ...>) [with F = LBENUM_t (*)(LBENUM_t); SignatureElements = {LBENUM_t, LBENUM_t}; PolicyInjectors = {}; lua_State = lua_State]’
/home/nhoeft/projects/luabind/luabind/make_function.hpp:113:119:   required from ‘luabind::adl::object luabind::make_function(lua_State*, F, meta::type_list<Types2 ...>) [with F = LBENUM_t (*)(LBENUM_t); PolicyInjectors = {}; lua_State = lua_State]’
/home/nhoeft/projects/luabind/luabind/function.hpp:27:61:   required from ‘void luabind::detail::function_registration<F, PolicyInjectors>::register_(lua_State*) const [with F = LBENUM_t (*)(LBENUM_t); PolicyInjectors = meta::type_list<>; lua_State = lua_State]’
/home/nhoeft/projects/luabind/test/test_implicit_cast.cpp:139:1:   required from here
/home/nhoeft/projects/luabind/luabind/detail/decorate_type.hpp:76:81: internal compiler error: Segmentation fault

The rest builds fine. Any idea?

Returning a null smart pointer from C++ does not return a nil object

When called from Lua, the following function returns an object rather than nil:

static std::shared_ptr<int> TestPtr()
{
    return nullptr;
}

It appears to go through value_converter::to_lua, which calls make_value_instance with a null pointer check anywhere.

Can you recommend a way to fix this behavior?

Thanks!

pure_out_value with discard_result

In the standard Luabind I can def a function with both of these such as:

.def( "GetString",      &IConfiguration::GetString, luabind::pure_out_value(_4) + luabind::discard_result )

With the boostless version you provide, I cannot seem to find a way to make both of these values work.

Is there a new method of handling both? At the moment I am trying the similar format of:

.def("GetConfigString", &IScriptManager::GetConfigString, pure_out_value<4>() + discard_result())

But this does not work.

const references to floats do not work with object calls

The following was written in VS2013 in 64-bit:

void testFloat(const float& f, luabind::object& o)
{
    o(f);
}

static const char TEST_LUA[] =
"function testFloat(f)\n"
"    print('Out: ' .. tostring(f));\n"
"end";

int _tmain(int argc, _TCHAR* argv[])
{
    lua_State* L = lua_open();
    luaL_openlibs(L);
    int error = luaL_loadstring(L, TEST_LUA) || lua_pcall(L, 0, 0, 0);

    luabind::open(L);
    luabind::object obj = luabind::globals(L)["testFloat"];
    testFloat(1.0f, obj);

    system("pause");

    return 0;
}

This throws with "Trying to use unregistered: float const * __ptr64".

For whatever reason the float is being interpreted as a class instead of a primitive value.

Any idea how this can be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.