Commit Graph

1079 Commits

Author SHA1 Message Date
Rapptz
7976b280e9 Add tests for issue #25 2014-06-09 09:18:29 -04:00
PrincessNyanara
6fbae52e9f container changes reverted
perhaps one day...
2014-06-09 06:29:06 -04:00
PrincessNyanara
0aab55cea4 inline fixes
static getter/pusher
container with Unqualified
not sure how I can make containers play nice without lookup...
2014-06-09 06:29:05 -04:00
PrincessNyanara
e5bb46afda better Or implementation
i don't think i use it anymore though...
2014-06-09 06:29:04 -04:00
PrincessNyanara
423e44d6dc all tests compile excepted related to test_table_return_two(), which uses contiguous container std::vector but has key-value pairs inside of it
c++ semantics dictate that it's accessed by index, but the tests seem to want to indicate that it should be accessed like a hashmap (or just using basic lua table semantics)
i have no idea how to make this incompatibility work in the new system...
i will ask repo master if he knows anything
2014-06-09 06:29:03 -04:00
PrincessNyanara
6712ebe0bd metamethods for containers represented using userdata,
`#` == __len
`[key] = value` == __newindex
`key` == __index
are not working properly for some reason, will need to investigate more deeply to find out why
on bright side all tests pass including new tests added (for take/return std::function)
fixed some things forgot to change with addition of upvalue_t for clarity (see previous commit about userdata/lightuserdata vs upvalue)
2014-06-09 06:29:01 -04:00
PrincessNyanara
3306b44162 okay std::function returns work
i want to use an is_function trait to differentiate classes when they get pushed
problem i feel that is_function may capture things not necessarily intended to be function objects
right now it is only qualified by pusher<function_t>
if change is necessary, then it becomes pusher<T, EnableIf<IsFunction<T>>>
2014-06-09 06:29:00 -04:00
PrincessNyanara
736d354861 distinction between "light user data" "user data" and "upvalue", as they are not the same thing
a lua upvalue can be lightuserdata, userdata, or anything else that can have its address taken (it's immediately popped of the stack and carted around with function call)
a lightuserdata can only be a pointer (void*)
a regular userdata can be anything, but is stored as void* because of "anything" semantics and C heritage of lua
upvalues deserve to use the `lua_upvalueindex(n)` macro: lightuserdata/userdata does not (must not) go through this process
2014-06-09 06:28:59 -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
ab935a01a2 Fix typo with bootstrap.py 2014-06-05 18:45:59 -04:00
Rapptz
047d9de0f8 Switched over to bootstrap.py script 2014-06-05 18:37:46 -04:00
Rapptz
462802a1f5 Add tests covering creation of tables from standard containers 2014-06-01 02:41:16 -04:00
Rapptz
675d42d281 Special casing push for types where T is base of reference 2014-06-01 02:10:36 -04:00
Rapptz
6eac584c2c Allow containers that use pairs as its value_type to return tables in lua as well 2014-06-01 01:07:26 -04:00
Rapptz
4cc402dc6e Refactored sol::stack::push to use sol::stack::pusher 2014-06-01 01:03:27 -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
Danny
072a88092f Merge pull request #31 from ThePhD/master
Fixed some bad formatting and a missing include guard
2014-05-31 18:11:38 -04:00
ThePhD
9c7e5f0b33 Fixed some bad formatting and a missing include guard. 2014-05-31 18:07:50 -04:00
Danny
be3d0ac27c Merge pull request #30 from ThePhD/master
Fixed segfault on GCC, updated ninja file for easier windows builds (and easier debug builds)
2014-05-31 15:30:36 -04:00
ThePhD
42978a9ed4 Fixed segfault on GCC. It was picking the wrong overload:
by forward-declaring the std::function overload in `stack`, it is able to find the right function to use.
All tests are passing
the ninja file has been tweaked to make it easier to invoke a g++ build on windows
2014-05-31 14:29:14 -04:00
Rapptz
08c94e1a67 Renamed demangling function 2014-05-31 06:08:12 -04:00
Rapptz
03f047ed05 Fix compiler error in GCC 2014-05-30 23:35:26 -04:00
Danny
56c6d41134 Merge pull request #27 from ThePhD/master
Adding std::function functionality for easier interop, interop with regular C++ classes at C++/lua boundary
2014-05-30 21:02:33 -04:00
ThePhD
0315a43b1b Userdata-classes are now the assumed type for any unmatching T which are not derived from sol::reference or not one of the basic types
tests added to confirm userdata can be passed into C++ function types
demangle is now named lua_demangle, and the core demangle without any replacements (to fit lua) is just named demangle
Formattings fixes everywhere
2014-05-30 19:58:47 -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
854d735410 Additional get_call argument that defaults index to 1 (first argument of stack).
tuple_types had overlapping purpose: we should split it up soon
2014-05-30 18:21:19 -04:00
ThePhD
61ecd1c87e Bug with pop_call when concerning certain argument orders. Popping of the end of the stack was too dangerous, so instead we use a get call and pop all stack arguments off afterwards: helps to preserve order. 2014-05-30 18:20:12 -04:00
ThePhD
fb1eb21f34 Additions for stack to properly handle std::function getters. std::function gets assume that the argument is a lua function and attempt to convert it to the type of function requested by the std::function's signature 2014-05-30 18:19:12 -04:00
ThePhD
5d5ce9cd2e get variant to easily get std::function from sol::function when using lua's call syntax. 2014-05-30 15:30:14 -04:00
ThePhD
c85fe4dc95 Merge remote-tracking branch 'root/master' 2014-05-30 15:29:13 -04:00
Rapptz
089b075317 Fix explicit operator bool to be negated is<nil_t>() 2014-05-29 22:19:21 -04:00
ThePhD
3fe8bf9c56 Merge remote-tracking branch 'root/master' 2014-05-29 10:12:53 -04:00
Rapptz
af1f13d582 Allow member functions that return *this to be binded properly. At the moment this means no member function chaining on the lua side 2014-05-29 04:13:24 -04:00
Rapptz
2376dc437b Stylistic changes to code 2014-05-29 02:57:11 -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
ThePhD
a8e9c01d0d Merge remote-tracking branch 'root/master' 2014-05-29 02:32:16 -04:00
ThePhD
c5d43bcfb6 as uses auto and decltype for return type 2014-05-29 02:32:05 -04:00
Rapptz
f9b6cf1595 Add a newline to every sol file missing one 2014-05-29 01:47:27 -04:00
Rapptz
accfd0f7a7 Add explicit operator bool for sol::object for even easier nil checking 2014-05-29 01:28:13 -04:00
Rapptz
54f030873f Remove reference when creating new reference types on the stack 2014-05-29 01:26:46 -04:00
Dave Snider
c73cd09261 partial fix for #108 2014-05-28 09:30:51 -07:00
Dave Snider
c5d2bf558d code font stack, fixes #121 2014-05-28 09:11:18 -07:00
Dave Snider
23bf5d281c math centering fixes #123 2014-05-28 08:49:43 -07:00
Danny
2f84be5c5e Merge pull request #22 from ThePhD/master
Fixing Issue #21
2014-05-26 20:16:17 -04:00
ThePhD
b153b34334 Added tests to ensure the derived/base case doesn't slip by us again! 2014-05-25 14:41:06 -04:00
ThePhD
936d52b6e6 main.ninja for compiling with QtCreator on Windows. Really need Shogun... 2014-05-25 14:25:08 -04:00
ThePhD
41e1ca2baa Additions for gitignore for the new files that are necessary to kick around qtCreator
Fix for userdata to accept base classes where the derived class uses the name of a base member function to access it (Derived::get_num, where get_num is only implemented in Base::get_num)
VC++ makes this acceptance easy by taking the name as "Derived", but GCC and Clang
2014-05-25 13:46:23 -04:00
ThePhD
b68a57c65c Fixed rename mishap 2014-05-25 12:30:44 -04:00