Code Monkey home page Code Monkey logo

luabind-deboostified's Issues

Permissive mode

The previous version of luabind was very permissive for script errors.
For example, you have a function and it is exported to Lua:

void func(int arg1, int arg2); // functions itself

def("func", &func) // export

If you pass to this functions wrong parameters, like this:

func("__") -- Passing string instead of a number. This is wrong!!!
		   -- The second argument is forgotten. This is wrong too!!!

Nothing will happen. The script just hang and that's all. No crash will proceed.

But in this new version it crashes on every error and doesn't have a permissive mode, which is bad for compatibility.

We should add some sort of permissive mode that ignores the errors like it was before.

GCC: wrong number of template arguments in out_value_policy.hpp

When building on Linux with GCC following error occures:

out_value_policy.hpp:220:33: error: wrong number of template arguments (1, should be 3)
    storage_.template construct<T>();

out_value_policy.hpp:241:33: error: wrong number of template arguments (1, should be 3)
storage_.template construct<T>();

Error build : error: ‘adopt_policy’ was not declared in this scope

Compiling on linux. Compiler gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)

CMakeFiles/test_abstract_base.dir/test_abstract_base.cpp.o: In function `luabind::detail::call_allocator(void const*, unsigned long)':
test_abstract_base.cpp:(.text._ZN7luabind6detail14call_allocatorEPKvm[_ZN7luabind6detail14call_allocatorEPKvm]+0x13): undefined reference to `luabind::allocator'
test_abstract_base.cpp:(.text._ZN7luabind6detail14call_allocatorEPKvm[_ZN7luabind6detail14call_allocatorEPKvm]+0x1a): undefined reference to `luabind::allocator_context'
collect2: error: ld returned 1 exit status
make[2]: *** [test/test_abstract_base] Error 1
make[1]: *** [test/CMakeFiles/test_abstract_base.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/test_attributes.dir/test_attributes.cpp.o: In function `luabind::detail::call_allocator(void const*, unsigned long)':
test_attributes.cpp:(.text._ZN7luabind6detail14call_allocatorEPKvm[_ZN7luabind6detail14call_allocatorEPKvm]+0x13): undefined reference to `luabind::allocator'
test_attributes.cpp:(.text._ZN7luabind6detail14call_allocatorEPKvm[_ZN7luabind6detail14call_allocatorEPKvm]+0x1a): undefined reference to `luabind::allocator_context'
collect2: error: ld returned 1 exit status
make[2]: *** [test/test_attributes] Error 1
make[1]: *** [test/CMakeFiles/test_attributes.dir/all] Error 2
/home/razor/Documents/luabind-deboostified/test/test_adopt_wrapper.cpp: In function ‘void test_main(lua_State*)’:
/home/razor/Documents/luabind-deboostified/test/test_adopt_wrapper.cpp:34:28: error: ‘adopt_policy’ was not declared in this scope
         def("make", &make, adopt_policy<0>()),
                            ^
/home/razor/Documents/luabind-deboostified/test/test_adopt_wrapper.cpp:34:44: error: expected primary-expression before ‘)’ token
         def("make", &make, adopt_policy<0>()),
                                            ^
/home/razor/Documents/luabind-deboostified/test/test_adopt_wrapper.cpp:35:44: error: expected primary-expression before ‘)’ token
         def("take", &take, adopt_policy<1>())
                                            ^
/home/razor/Documents/luabind-deboostified/test/test_adopt.cpp: In function ‘void test_main(lua_State*)’:
/home/razor/Documents/luabind-deboostified/test/test_adopt.cpp:57:42: error: ‘adopt_policy’ was not declared in this scope
   def("take_ownership", &take_ownership, adopt_policy<1>()),
                                          ^
/home/razor/Documents/luabind-deboostified/test/test_adopt.cpp:57:58: error: expected primary-expression before ‘)’ token
   def("take_ownership", &take_ownership, adopt_policy<1>()),
                                                          ^
make[2]: *** [test/CMakeFiles/test_adopt_wrapper.dir/test_adopt_wrapper.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/test_adopt_wrapper.dir/all] Error 2
make[2]: *** [test/CMakeFiles/test_adopt.dir/test_adopt.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/test_adopt.dir/all] Error 2
make: *** [all] Error 2

Incorrect function overloading

If you have function with default arguments, like this:

void Kill(CScriptGameObject* who, bool bypass_actor_check = false);

It would be exported to Lua as a functions that accepts two arguments, but not one. If you will try to call it with one argument it will crash.

In the previous luabind version you could use casts to fix the problem:

.def("kill", (void (CScriptGameObject::*)(CScriptGameObject*))&CScriptGameObject::Kill)
.def("kill", (void (CScriptGameObject::*)(CScriptGameObject*, bool))(&CScriptGameObject::Kill))

In this new version this doesn't help. The second parameter will be filled with trash.

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.