Commit Graph

26 Commits

Author SHA1 Message Date
ThePhD
eb25bb05bb Overloaded functions now work properly when types are specified in signature
this triggered overhaul of set_function/pusher<function_t>::push(...)
both state and table reflect changes to userdata structure to make it easier to use
tests updated to account for overload resolution
some function-related traits added to make use easier -- cleaned up archaic typenames in function_types.hpp
Account for std::reference_wrapper for objects -- sol now uses copy-by-default (value-semantics) for all functors
updated tests to reflect this
2014-06-28 23:16:48 -07:00
ThePhD
d35de4a8fa Fix for Issue #35
Userdata now properly forwards arguments to constructor
get_call now properly has extra parameters to allow for forwarding items from the first call that are not popped
Added tests to cover new cases
2014-06-27 01:25:57 -07:00
PrincessNyanara
e5bb46afda better Or implementation
i don't think i use it anymore though...
2014-06-09 06:29:04 -04:00
PrincessNyanara
77901bb654 massive rework of stack
get turned into getter<T>, matches pusher<T> and uses same semantics as std::allocator and other things used throughout the codebase
-----
userdata has its traits defined outside in new file of userdata to prevent errors when trying to use those typetraits in places before userdata.hpp gets included
userdata was changed to support returning itself via pointers or references.
rework of stack changes semantics based on T&, T*, and T&& (the last one tries to create a new userdata and move in data)
solves problems maybe presented in https://github.com/Rapptz/sol/issues/25

-----
container.hpp is attempt at solving original problem before going on wild tangent with userdata, stack, and get
is going to attempt to use userdata to allow transporation of containers losslessly, perhaps without copying need
-----
found out trying to return a std::function does not work -- not sure what do exactly?
perhaps should push c closure as last thing, but right now it is tied to a key value (code comes from table.hpp and set_function)
will just have to think over how stack arranges itself and learn what to do
2014-06-09 06:28:55 -04:00
Rapptz
76b1efe12e Revamp EnableIf and DisableIf to use a much better variadic condition checking 2014-05-31 22:04:10 -04:00
Rapptz
eedb2a1796 Add key value pair trait 2014-05-31 21:10:42 -04:00
Rapptz
5c8f661447 Allow functions that return C++ sequential containers to return tables on the lua side 2014-05-31 20:02:54 -04:00
ThePhD
a842060e4d Removed std::true_type/false_type from tuple_types and created a separate is_tuple trait, so that we can use ::type on tuple_types without it interfering with base typedefs in std::true/false_type
Fixing some identation
Moved are_same type traits to traits.hpp
2014-05-30 19:10:08 -04:00
ThePhD
065215864b libstdc++ is literally the dumbest thing in the world and does not properly remove const from types with references
Must remove_reference<T> before remove_cv<T>
2014-05-29 02:38:02 -04:00
Rapptz
f9b6cf1595 Add a newline to every sol file missing one 2014-05-29 01:47:27 -04:00
ThePhD
ff7326ed96 We now have the ability to get a userdata that has been created C++ style out of lua
Using `auto` and `decltype` in more places that MSVC can handle it -- using type traits in other places to avoid VC++'s chokes
More flexibility, woo!
2014-05-09 10:48:55 -04:00
ThePhD
d7ea4718c8 multi_return<> name to return_type<> .
Makes more sense, as the return does not always have to be multiple types.
(Indeed, it is specialized for 1 and 0 cases).
2014-05-08 13:08:21 -04:00
ThePhD
c0b565fa3d Renamed many parts of lua_function.hpp to make more sense.
Added pop() function to `reference`
`stack.hpp` now has many more functions to properly handle user data
`types.hpp` now has `userdata_t` and `lightuserdata_t` to faciliate `stack`'s `pop` and `push` operations
Class binding functionality built into `table` and `state`, as well as placed in `userdata` class in `userdata.hpp`
demangling detail now present for clang, gcc, and MSVC (somewhat for MSVC)
Constructor arity still needs to be handled for `userdata<T>`
tests updated and passing
2014-04-25 20:20:35 -04:00
ThePhD
750d110a92 Fixing formatting to make sure everything's nice and pretty. 2013-12-21 22:11:20 -05:00
ThePhD
ef223ecaeb I wish C++ didn't demand that functions have to appear before each other in lexographic order. =/ 2013-12-21 19:39:51 -05:00
ThePhD
b90f789986 operator[] support~
And all is as it should be in the world~
2013-12-21 19:30:30 -05:00
Rapptz
ac975872ad Remove support for operator[] on tables 2013-12-16 11:07:10 -05:00
ThePhD
ed0b83f8b0 Several changes. I took away operator() for the proxy type, because it'd interfere with the Callable type and all. Alas, good things do die I suppose. =[
But! I left it on the `sol::function` type, because it's necessary to discard returns. The .call is still there, though, just incase you need it. <3
reverse_indices_builder is also there, to make sure we can push and pop without the lua api taking our types and breaking them for the std::tuple returns.
All is at it should be~
2013-12-14 23:25:44 -05:00
ThePhD
b655c07258 Merge remote-tracking branch 'root/master' 2013-12-14 20:07:35 -05:00
Rapptz
5341682503 Change tabs to spaces 2013-12-14 04:42:53 -05:00
ThePhD
25f42b4bd3 A hefty slice of changes for functions on the proxy. Not necessary, but was fun to get around MSVC's ICE errors. 2013-12-14 00:15:14 -05:00
ThePhD
9624dd93e7 VC++ Compat again. 2013-12-13 20:09:51 -05:00
ThePhD
856d28ab70 EnableIf and DisableIf back in place, type trait fixed for MSVC. Bleh, this is a lot of work. Removed functional header, because nobody's using it. 2013-12-13 14:59:46 -05:00
ThePhD
2192e98eec MSVC needs explicit overloads and explicit =default operators on sol::function. It's quite whacky, really. Anyway, it compiles, so let's just make sure this works for GCC too. 2013-12-13 14:16:59 -05:00
Rapptz
af0097fb7f Add support for setting functions with operator[] 2013-12-12 19:48:26 -05:00
Rapptz
7cc8c93289 Move type traits to its own header and clean up code using the traits 2013-12-12 18:43:36 -05:00