Giter Site home page Giter Site logo

lua-api-pp's People

Contributors

newnon avatar oldfisher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lua-api-pp's Issues

pcall return value

I'm using visual studio 2015 (msbuild) and having an issue with wrapping function calls.

I have a function that looks like this:

GetMethodFromModule(module_name, method_name).pcall(std::forward<Args>(args)...);

How do I actually check for an error, pcall returns a lazy, and I've tried explicitly setting it to a lua::Value but it doesn't seem to give me what I want.

I can do

auto error = GetMethodFromModule(module_name, method_name).pcall(std::forward<Args>(args)...).cast<std::string>();

But then I'll get a bad cast if there is no error.

Any suggestions of how to get the error out of the pcall method?

Request for wrapping std::vector

Is it possible to wrap std::vector types (ideally just float, string, int etc...) to automatically convert to tables? This library is great but I feel this is something it's possibly missing. I'm just looking to be able to do something like:

std::vector read_list(size_t count);
void write_list(std::vector list);

...

c.global["read_list"] = read_list;
c.global["write_list"] = write_list;

I'll look into seeing if it's something I can maybe try developing myself but was just wondering if anyone else has already either done it or at least thought about it.

Any calls to `Context::requireArgs` are not compiled.

Anytime this function is called, I'm getting quite verbose compile errors:

[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:405:6: error: call to member function 'push' is ambiguous
[build]                         S.push(V);
[build]                         ~~^~~~
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:442:12: note: in instantiation of member function 'lua::_::lazyImmediateValue<unsigned long>::push' requested here
[build]                                 policy.push(S);
[build]                                        ^
[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:898:8: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyImmediateValue<unsigned long> >::push' requested here
[build]                                 l2.push();
[build]                                    ^
[build] ../modules/lua-api-pp/luapp/lua_operations.hxx:162:25: note: in instantiation of function template specialization 'lua::_::lazyConcatSelector::pushOnly<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *, unsigned long>' requested here
[build]                                 lazyConcatSelector::pushOnly(S, L1, L2);
[build]                                                     ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:454:12: note: in instantiation of member function 'lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long>::pushOnly' requested here
[build]                                 policy.pushOnly(S);
[build]                                        ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:728:10: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >::pushOnly' requested here
[build]                                 lref.pushOnly();
[build]                                      ^
[build] ../modules/lua-api-pp/luapp/lua_lazy.hxx:454:12: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
[build]                                 policy.pushOnly(S);
[build]                                        ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:767:6: note: in instantiation of member function 'lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> >::push' requested here
[build]                         l.push();
[build]                           ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:684:4: note: in instantiation of function template specialization 'lua::Context::push<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> >' requested here
[build]                         push(std::forward<T>(val));
[build]                         ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:294:4: note: in instantiation of function template specialization 'lua::Context::ipush<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> > >' requested here
[build]                         ipush(std::forward<MsgType>(msg));
[build]                         ^
[build] ../modules/lua-api-pp/luapp/lua_impl.hxx:1487:4: note: in instantiation of function template specialization 'lua::Context::error<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyConcat<lua::_::Lazy<lua::_::lazyWhere>, const char *> >, unsigned long> >, const char *> >, unsigned long> >, const char *> > >' requested here
[build]                         error(where() & " Insufficient number of arguments (" &  nArgsExpected & " expected, " & args.size() & " passed).");
[build]                         ^
[build] ../modules/Script/include/Script/Observer.hpp:20:17: note: in instantiation of function template specialization 'lua::Context::requireArgs<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' requested here
[build]         context.requireArgs<std::string>(1);
[build]                 ^
[build] ../modules/lua-api-pp/luapp/lua_context.hxx:697:8: note: candidate function
[build]                 void push(bool) noexcept;
[build]                      ^
<and many more possible candidate functions...>

I have diagnosed it and turns out that the Context class is lacking the following member function overloads:

void push(long val) noexcept;
void push(unsigned long val) noexcept;

It's because Context::requireArgs and Context::requireArg use string concatenation with the operator& overload combined with arguments of size_t. Adding the overloads above seems to have fixed this issue.

Help: global access and VS2013.

Hi, I'm finding C++11 Lua wrapper library. I have found sol, selene and this library. but I found some diffcult to try this library:

  • how can I access global environment when I only have a lua::State? I just find get global in lua::Context, but it requires to call a functions (state.call), how can I just retrieve some informations without call a function? (I just use Lua as a configuation language in my project).
  • It seems can not compiles in VS2013, is there any plans to support it on Winodws?

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.