Commit Graph

39 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
b41f92adc9 updated tests
fixed small error in state with new system
all tests passing GCC 4.9 std=c++11
2014-06-27 21:34:18 -07:00
ThePhD
36e45d88b2 userdata no longer needs to be kept around for its lifetime
can be discarded and lua VM will keep all necessary information
2014-06-27 21:27:48 -07: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
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
Rapptz
f9b6cf1595 Add a newline to every sol file missing one 2014-05-29 01:47:27 -04:00
Rapptz
932e29a841 Renamed sol_error to error 2014-05-21 22:24:15 -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
Rapptz
cd092d3bfb Add new_userdata to create internally memory managed userdata from sol::state 2014-04-27 05:09:28 -04:00
Rapptz
a2c26a042c Rename set_class to set_userdata 2014-04-27 04:11:30 -04:00
ThePhD
0088002abf Class binding now works with multiple functions
Refactoring on function_types.hpp performed to slim down some of the calls: could use more refactoring
Drastically simplified userdata's binding capabilities: constructor supports both `:` and `.` syntax (but member functions DO NOT).
All tests are passing
2014-04-26 18:24:54 -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
b1504ad1b3 Missing inline on several functions; causes compilations when sol is included in multiple Translation Units.
`function.hpp` needed cstdint to be defined to use unit32_t properly.
2014-04-24 16:46:11 -04:00
Rapptz
44bbdcc4c3 Add lua_state function to retrieve the lua_State pointer 2014-01-26 00:25:46 -05:00
ThePhD
750d110a92 Fixing formatting to make sure everything's nice and pretty. 2013-12-21 22:11:20 -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
f8cfb80a45 Fixed a bug with the return order and added tests to make sure it works.
Added the ability to get mutiple values when doing `table.get` or `state.get`.
Lua is hard. :c
2013-12-15 22:09:06 -05:00
Rapptz
5eeaedec2f Basic operator[] support for tables 2013-12-12 18:12:07 -05:00
Rapptz
9f36db8148 Rename script_file to open_file 2013-12-12 05:31:35 -05:00
Rapptz
c241a3df92 Remove redundant check for narr and nrec variables in create_table 2013-12-12 05:12:45 -05:00
ThePhD
2b4f9cc24c Meh, who needs "eval". It's technically right, but I think evaluate might be for shorter lines and stuff... who knows. 2013-12-11 18:16:52 -05:00
ThePhD
350f430d74 Improved tests, added a build.ninja for TeamCity, and fixed formatting again to work with Rapptz's style. 2013-12-11 11:18:13 -05:00
Rapptz
599673150e Remove construction from a filename as it's pretty useless 2013-12-09 00:22:37 -05:00
ThePhD
854cbeef71 Fixing style to fit @Rapptz's usual no-tabs, four-space-indents, template<> no-spaces stuff. 2013-12-08 23:09:07 -05:00
ThePhD
8c023c54a5 This properly pushes a local function to the table. However, we're having issues because the tables are being constructed without an attachment to sol::state, making it impossible to keep std::shared_ptr's alive that contain the virtual interfaces necessary to handle those goddamn lambdas. 2013-12-07 21:16:23 -05:00
Rapptz
101e80c913 Remove unused unordered_map 2013-12-02 23:59:44 -05:00
Rapptz
6ff859ba29 Stylistic changes to match the rest of the code 2013-12-02 23:33:23 -05:00
ThePhD
bf2404bdfd More style fixes and more attempts to make sure this compiles between GCC and MSVC. 2013-12-02 19:15:23 -05:00
ThePhD
29f171e124 Style fixes and fixes for templates not usually used by MSVC (broken two-phase lookup killing me here. :c)
Member functions now work as well for set_function. If performance of `new`ing a type ever becomes too large, we can create a custom allocator for the std::shared_ptr's of the types. We can also up-front allocate for the unordered_map as well.
2013-12-02 18:11:25 -05:00
ThePhD
be98a4fdd4 Reformatted to look like Rapptz's style. The following code sample work without error in VS 2013: http://pastebin.com/s4Jbjnht
It'll be up to @Rapptz's to make further changes to make sure GCC compiles, but the core of the functionality is there and my work is essentially done.
Class bindings are up next, but really I don't want to even touch those. :c
2013-12-02 15:42:03 -05:00
ThePhD
f67b21b525 The solution technically works, but there's some stack corruption going on somewhere that I can quite track down, even when calling a void function with no parameters. I'll have to look into it... 2013-12-02 14:22:51 -05:00
ThePhD
24c76d3e03 Added VS2013 files to gitignore. 2013-12-01 17:27:17 -05:00
Rapptz
294e37f822 Allow creation of tables 2013-11-26 04:06:48 -05:00
Rapptz
c3ca4d9610 FIx error with loading coroutine library 2013-11-26 01:07:18 -05:00
HFCPC
bf90dbcc81 Fix error with sol::state set function returning an instance of the global table 2013-11-25 16:45:00 -05:00
HFCPC
c8c82ee56b Add support for specific library imports 2013-11-25 15:53:28 -05:00
Rapptz
f775790c2d Initial commit 2013-11-25 04:56:27 -05:00