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
9c7e5f0b33
Fixed some bad formatting and a missing include guard.
2014-05-31 18:07:50 -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
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
Rapptz
089b075317
Fix explicit operator bool to be negated is<nil_t>()
2014-05-29 22:19:21 -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
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
Rapptz
932e29a841
Renamed sol_error to error
2014-05-21 22:24:15 -04:00
ThePhD
f17d30592c
Fixing some basic bugs MSVC didn't catch
2014-05-09 19:32:31 -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
be839bdcd2
We no longer need the register_into(const table& s)
function: removing~
2014-04-27 09:13:45 -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
0ff295f61e
Switch from static member strings to userdata_traits
2014-04-27 05:08:39 -04:00
Rapptz
a2c26a042c
Rename set_class to set_userdata
2014-04-27 04:11:30 -04:00
Rapptz
6a280dc131
Format changes
2014-04-27 03:25:47 -04:00
Rapptz
2f76b96061
Switch member function pointer and string pair in initialisation
2014-04-27 02:35:11 -04:00
Rapptz
b323a62b2a
Fix compiler error with cv-qualifiers on member function pointers
2014-04-27 02:26:06 -04:00
Rapptz
8cd3b18f7b
Fix test failure
2014-04-27 01:29:37 -04:00
Rapptz
63bc2b06cb
Fix compiler errors, tests failing however
2014-04-27 00:53:57 -04:00
ThePhD
a525760178
Fixed some bad spacing.
2014-04-26 21:38:37 -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
4d6d39be88
Merge remote-tracking branch 'root/classes'
2014-04-26 00:19:45 -04:00
ThePhD
4c102605e8
Custom constructors, but apparently there's something on the stack and we can't get at its type?
2014-04-26 00:19:36 -04:00
Rapptz
077f5fd258
Massive renaming of lua_function.hpp
2014-04-25 22:05:58 -04:00
Rapptz
5229cace49
Moved pop from reference to table
2014-04-25 21:40:52 -04:00
Rapptz
c9bf032d36
Fix all compile errors on GCC
2014-04-25 20:53:36 -04:00
Rapptz
6b54f99e50
Do some renaming of lua_function.hpp and fix some compiler errors
2014-04-25 20:42:38 -04:00
Rapptz
44eab5a164
Refactor demangle.hpp to look a bit nicer
2014-04-25 20:19:31 -04:00
Rapptz
23ed27df89
Renamed DEPRECATE to SOL_DEPRECATED
2014-04-25 20:11:00 -04:00
ThePhD
2243bec052
userdata<T> now works and compiles on MSVC.
...
It's going to take serious work to make it happen in GCC, plus the fact that 4.9 is still giving me
so many errors I can't even read it...
I'll let Rapptz figure it out, but later.
Sexy class bindings, yes!
2014-04-25 20:08:07 -04:00
ThePhD
359848f371
Demangler is alive, it seems. But honestly, MSVC is kind of crappy about it: perhaps, later, we'll just take a string indicating the name of the class.
...
main.cpp contains the test implementation for the lua classes -- woo!
2014-04-25 20:08:07 -04:00
ThePhD
c145759da8
Deprecation mechanism, improvements to lua_function's classes, and demangling for MSVC and gcc/clang
2014-04-25 20:08:07 -04:00
ThePhD
9328271d06
Renames for lua_function's internal types and some early-caught fixes for using the right type for the member of the function
...
Preparation for dumping whole classes into lua... it's going to be fairly tough making this one work.
2014-04-25 20:08:07 -04:00
ThePhD
63a4dafce5
Better names for the functors in preparation for working with whole classes of them. This is going to be tough...
2014-04-24 16:46:31 -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
faa14f3d35
Merge branch 'master' of https://github.com/Rapptz/sol
2014-01-26 17:06:05 -05:00
Rapptz
44bbdcc4c3
Add lua_state function to retrieve the lua_State pointer
2014-01-26 00:25:46 -05:00
Rapptz
02f8248d0f
Fix compiler error from using sol::sol_error in get_nil
2014-01-22 12:51:09 -05:00
ThePhD
750d110a92
Fixing formatting to make sure everything's nice and pretty.
2013-12-21 22:11:20 -05:00
ThePhD
94c287810f
It took a lott of work, but we finally have the right rankings for operator[] to work as intended with as minimal room for screwups as possible.
...
This should enable operator[] to work in all cases that it is to be expected, thanks to a lot of explicit conversions and some basic overload resolution ranking tricks (e.g., making some conversions a template).
We also need to remember that GCC expects `. template (function name)` in generic code, as it can parse things in a really dumb and silly manner.
2013-12-21 22:00:28 -05:00
ThePhD
cfda1d34ba
Trying to guess what GCC wants in this case is baffling...
2013-12-21 19:51:48 -05:00
ThePhD
4f279c5033
Strangely enough, GCC can't handle having T_
as a typdef.
2013-12-21 19:44:31 -05:00
ThePhD
7ca6ce8d55
Forgot a dot.
2013-12-21 19:42:50 -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
cb492e7c29
Squashing those GCC warnings.
2013-12-15 22:14:56 -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
ThePhD
e0bcf5a11e
Ordering things more nicely for GCC and fixing calls to always used extra types
parameters when they can for early-out decltype deduction, rather than recursive template reliance (compiles better for VC++ and resolves earlier for g++).
2013-12-15 17:09:23 -05:00
ThePhD
c8417d65de
decltype
with types
. It seems unfair.
2013-12-15 16:56:01 -05:00
ThePhD
63536dd8d0
Why not cheat with an extra types
? Who needs type deduction when you can just pass the right types directly?
2013-12-15 16:52:01 -05:00
ThePhD
b9b32baf1a
declval is in the std namespace, derp.
2013-12-15 16:46:57 -05:00
ThePhD
94405d0346
Fixing lua function, attempting another fix for rtl_pop
2013-12-15 16:45:40 -05:00
ThePhD
8ef3ceb8a0
New test cases for the order of returns. Apparently, its screwing up between both lua and C++. Have to test thoroughly. Changes currently are half-working.
2013-12-15 16:27:20 -05:00
ThePhD
6101865c1e
GCC warnings can go suck a duck.
2013-12-14 23:31:23 -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
4f197dbb91
operator!= for nil_t
2013-12-14 20:16:28 -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
Rapptz
f061e0040d
Add operator== and operator!= support for sol::object and nil
2013-12-14 00:28:14 -05:00
ThePhD
20ff49cd66
Merge remote-tracking branch 'root/master'
...
* root/master:
Cast result of floating point retrieval before receiving it
Fix bug with sol::object not being copyable
2013-12-14 00:15:25 -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
Rapptz
a6306d7012
Cast result of floating point retrieval before receiving it
2013-12-14 00:07:41 -05:00
Rapptz
c59fc9e536
Fix bug with sol::object not being copyable
2013-12-14 00:05:14 -05:00
ThePhD
49ad128493
If you want to have return types, use .call
instead of operator()
.
2013-12-13 23:30:16 -05:00
ThePhD
c6f6203ab2
We can avoid unused variable issues entirely and keep MSVC from borking out by explicitly declaring the size of the swallow
declaration. This should make all compilers happy.
2013-12-13 23:26:59 -05:00
ThePhD
009a79606a
It has to be a reference, not a value. I mistakenly thought typename Table
was taken by reference... oh well. It's fixed now. I wish VC++ didn't choke so badly on decltype.
2013-12-13 22:34:56 -05:00
ThePhD
9624dd93e7
VC++ Compat again.
2013-12-13 20:09:51 -05:00
ThePhD
4dab754b86
VC++ Compatibility and some changes to function I'll need to test.
2013-12-13 17:50:24 -05:00
Rapptz
ebbceeb9e2
Add support for const table operator[] retrieval
2013-12-13 15:40:20 -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
dc6935553b
Forgot a private on table.
2013-12-13 14:19:04 -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
Rapptz
5eeaedec2f
Basic operator[] support for tables
2013-12-12 18:12:07 -05:00
Rapptz
d44a215216
Remove trivial destructors from lua_func types
2013-12-12 14:36:09 -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
Rapptz
fdf145ecd8
Minor stylistic changes to be consistent
2013-12-12 05:11:09 -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
459bbcaba0
GCC is lame. But at least it's building now. Fixed up the build.ninja and made all tests pass (exceptions weren't being thrown because of lua_pcall
: use lua_call
to let exceptions propogate naturally).
2013-12-11 12:42:00 -05:00
ThePhD
bcf4b9b08f
Have I mentioned I hate GCC? I hate GCC.
2013-12-11 11:56:34 -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
ThePhD
dd63621453
Added some catch tests and a basic nil getter.
2013-12-11 08:32:27 -05:00
ThePhD
fc19896815
Some changes to make sure builds go through on 64-bit.
2013-12-11 06:10:30 -05:00
Rapptz
9e47ec6b06
Merge branch 'master' of https://github.com/ThePhD/sol into ThePhD
2013-12-09 17:20:21 -05:00
ThePhD
e53c47f7b1
Okay, so now it compiles without errors or warnings and works pretty well. This should be the last piece necessary for full working conformance. Yey~
2013-12-09 17:01:52 -05:00
Rapptz
404dc641a9
Merge branch 'master' of https://github.com/ThePhD/sol into ThePhD
2013-12-09 14:27:39 -05:00
ThePhD
19d01ecd1d
Okay, cleaned up includes and now the newest feature:
...
STATEFUL FUNCTIONS!
Any stateful function now works and is properly cleaned up, thanks to some additional metatables that are associated with the function values.
This lays the ground work for class bindings, but that's a far off dream. For now, table retrieval and `operator[]` is what's for dinner.
2013-12-09 14:12:38 -05:00
ThePhD
21142e7e7d
Removed std::unordered_map storage on tables since they were getting deleted anyways.
...
Memory leaks are currently present: will have to figure out how to patch those up.
2013-12-09 12:05:17 -05:00
Rapptz
599673150e
Remove construction from a filename as it's pretty useless
2013-12-09 00:22:37 -05:00
ThePhD
51f7010363
Additional nullptr
's for GCC's whining ass, and more reinterpret casts. Also for GCC's whiny ass.
2013-12-09 00:04:37 -05:00
ThePhD
2d2ad59492
Well, now that we've optimized l-values, the only reason for explicit_lua_func and member pointers is for it to actually store it. To we store a T
now, isntead of a T*
.
2013-12-09 00:01:28 -05:00
ThePhD
a66ceb92f7
GCC is retarded. Well, mostly retarded, anyhow...
2013-12-08 23:51:18 -05:00
ThePhD
288fd1319c
Ranged for loop. Because ~~clean code~~.
2013-12-08 23:42:20 -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
49c73c4725
Heavy optimizations to stateless and lvalue member functions allow us to make many of the general use cases of lambdas and member function pointers work out.
...
This will be useful. The next fix has tobe in table.hpp in the std::false_type ... specialization of the private `set_fx` function.
2013-12-08 23:05:03 -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
a4a4d21376
Allow polymorphic object class to handle sol::function
2013-12-03 01:20:31 -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
45000177c3
Alright, this should fix the GCC build errors! Everything should work as advertised. A Sol for the Mun: go, go!
2013-12-02 21:39:21 -05:00
ThePhD
86b16dc61b
GCC is still not compiling, complaining about detail::ltr_pop and not being able to find a proper overload. I'm not sure why it's complaining, I'll have to look in more detail soon.
2013-12-02 20:12:25 -05:00
ThePhD
17ec059c32
Move ltr_pop down, so that GCC can see the right instantiations of the functions it needs.
2013-12-02 19:34:10 -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
ebf4908c27
Formatting corrections
2013-12-01 18:57:28 -05:00
ThePhD
9f79e8c573
function header with addition to sol.hpp so that a person can do function invocations on lua functions without explicitly adding sol/functions.hpp
2013-12-01 18:15:26 -05:00
ThePhD
24c76d3e03
Added VS2013 files to gitignore.
2013-12-01 17:27:17 -05:00
Rapptz
1f22cdd19e
Add size function to query table size
2013-11-30 21:17:15 -05:00
Rapptz
83cfcc3694
Add polymorphic lua object type
2013-11-30 21:12:50 -05:00
Rapptz
b80e77b9c2
Add using statements for basic EnableIf and DisableIf
2013-11-29 17:57:46 -05:00
Rapptz
8ed913e8c1
Allow specification of index in get<T> function
2013-11-28 22:51:51 -05:00
Rapptz
796fd6903e
Switched pop to get and wrote a new pop<T> function
2013-11-28 18:27:27 -05:00
Rapptz
f49e35a105
Add call function to transform a tuple into function arguments
2013-11-28 06:50:26 -05:00
Rapptz
4f714539d6
Make reference pushing take an actual reference to the object instead of by value
2013-11-26 05:07:10 -05:00
Rapptz
294e37f822
Allow creation of tables
2013-11-26 04:06:48 -05:00
Rapptz
12aac41b9e
Readd support for types that inherit from reference
2013-11-26 04:05:04 -05:00
Rapptz
ecb44462af
Revert "Allow push to work with types that inherit from reference"
...
This reverts commit f2d72f7bb2
.
2013-11-26 01:21:53 -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
f2d72f7bb2
Allow push to work with types that inherit from reference
2013-11-25 16:44:05 -05:00
HFCPC
c8c82ee56b
Add support for specific library imports
2013-11-25 15:53:28 -05:00
Rapptz
45f801f740
make pop<bool> compare to 0 instead of casting to bool
2013-11-25 06:14:46 -05:00
Rapptz
1c423da153
Removed uses of constexpr for MSVC 2013
2013-11-25 05:20:14 -05:00
Rapptz
f775790c2d
Initial commit
2013-11-25 04:56:27 -05:00