Commit Graph

740 Commits

Author SHA1 Message Date
ThePhD
e69e7c79fa C++17 additions: std::variant, string_views of all types, checker for if we have the right version
added variadic_results, to return a variable number of arguments to Lua
added variadic_results and as_results
added improved function examples (for multiple results and split overloading out)
added tests for variadics
added tests for C++17 utilities
added a forwarding header
added a specific `unsafe_function` header
added and improved documetation pages
2017-07-09 12:54:52 -04:00
Rohlem
077448bfc8 enable move semantics when pushing rvalue optional
add forward_like-style cast to stack::pusher<optional<O>>
2017-07-06 20:13:09 -04:00
ThePhD
504f49f3c7 update state to use default handler 2017-07-04 04:41:32 -04:00
ThePhD
da28527421 prepare for container_traits to be a thing
update large parts of the documentation and add a new section to streamline information about functions
2017-07-01 11:02:15 -04:00
ThePhD
1a6937e24e Revert previous change of not pushing nil when we encounter a nullptr from special usertypes. If people want to check, they'll need to use optional or a raw pointer: messing with the raw usertype can also lead to some surprising problems, so we don't need to specialize for that use case. 2017-06-30 18:18:25 -04:00
Ilia Udalov
8d5aa69117 Fix compilation on Max OS X with lua 5.1 2017-06-27 21:26:07 -04:00
ThePhD
af2136ba00 Closes #431
If only I had a test that took a unique_ptr as a second argument. RIP.
2017-06-26 10:10:47 -04:00
ThePhD
13370e7e42 more constructors PogChamp 2017-06-24 10:20:07 -04:00
ThePhD
17271c84cb BREAKING CHANGE: std::pair for regular containers that are not marked as as_table_t or as_nested will now behave like regular containers and not force themselves to be key-value pairs. table-style serialization is still unaffected. 2017-06-23 18:07:24 -04:00
ThePhD
6b34a15d68 it would help if I was not blind 2017-06-19 23:06:57 -04:00
ThePhD
5468ab8b4e Let's hope we didn't break shit... 2017-06-19 23:04:23 -04:00
ThePhD
5363a63de0 g++ sometimes chokes on parsing certain combinations of characters because of disambiguation rules 2017-06-17 00:52:02 -04:00
ThePhD
b811e73b90 who knew noexcept proofing would be so hard...? And there's so many places it could be activated in...! 2017-06-17 00:43:26 -04:00
ThePhD
11916a7c72 add noexcept function type barriers and guards
noexcept-proof function call trampolines
add noexcept tests to ensure its being checked
TODO: check g++ 7.1 builds when using -std=c++17 ...
2017-06-16 18:43:40 -04:00
Rohlem
39fdb5e041 add noexcept specializations to meta (detail) template trait structs
fixes the noexcept tests for C++17 (on my compiler)
2017-06-16 13:35:28 -04:00
ThePhD
0fb53335c4 this commit adds support for differentiating between multiple different unique_usertypes without actually having to store type information. It does not include the ability to override a unique_usertype label for a specific type, but that might not prove necessary if differentiation remains possible with this methodology
Complete fixes #422 and addresses #423
2017-06-15 01:23:51 -04:00
ThePhD
85620df63c new checker for unique_usertype to ensure type safety, when SOL_CHECK_ARGUMENTS or a protected tag is used to protect a function 2017-06-13 16:34:18 -04:00
ThePhD
42253cadfb guard against is_integral accepting booleans as integers 2017-06-12 10:45:51 -04:00
ThePhD
661386c384 revert codecvt fix for MinGW v7 and greater
add docs about compiler support
add notes about compilation issues
update single
2017-06-07 12:33:59 -04:00
ThePhD
090c834f2c Let nullptr pass through, but we still can't do a conversion from lua_nil to unique_usertypes. 2017-06-07 11:02:47 -04:00
ThePhD
ea895b4338 hard errors for container usertypes if SOL_CHECK_ARGUMENTS is defined.
otherwise, as usual, we assume you know what you're doing
2017-06-03 06:25:06 -04:00
ThePhD
51245a9e7b go to hell, gcc and clang 2017-05-29 13:06:37 -04:00
ThePhD
fd8e2df92e fix some semantics for container usertypes, their iterators, and how they push their value types (to cope with crappy input iterator "containers")
add better handling for `readonly` to prevent bugs from `const`-ifying the return value of a member variable (e.g., unexpected copy semantics)
add more tests and add a few more handlers for new readonly type
fix simple_usertype_metatable's handling of newindex and index when not at the top level
2017-05-29 10:32:37 -04:00
ThePhD
c6d11a2bac fix index and newindex semantics on simple_usertypes
we do not have to hit the metatable by-name since we go to special lengths to ensure we have a simple usertype table we can use
2017-05-28 19:14:18 -04:00
ThePhD
6047f48343 vet container_usertype and wrap for the proper traits regarding assignment and checking of said assignments
update documentation with more tips and other similar things
2017-05-20 20:01:04 -04:00
ThePhD
5ff394ae0d use the copy assignable trait, even if that's not exactly what we're going for... 2017-05-16 20:20:59 -04:00
ThePhD
51d6f6fa54 You would think that we'd have accounted for this earlier...
Fixes #405
2017-05-16 06:12:28 -04:00
ThePhD
34b81bef6b Handle qualified name failures of VC++, where using templates do not match the fully qualified names of what they alias to (Thanks, VC++) 2017-05-15 10:41:50 -04:00
ThePhD
86e2de297d update single, ensure unused variables are axed 2017-05-09 13:31:44 -04:00
ThePhD
58003669fb this_environment is now live 2017-05-09 13:24:56 -04:00
ThePhD
c7237806ef add a new example, add a note, adjust for LuaJIT Beta3 and beyond (hopefully it doesn't flip its crap: will have to warn suers....) 2017-05-07 10:16:47 -04:00
Carlos Carrasco
e13711ed84 add find method to containers to make fast lookups into set/unordered_set 2017-05-03 18:54:38 -04:00
ThePhD
fc3e7c40f3 static properties work as intended, I guess 2017-04-25 19:44:53 -04:00
ThePhD
c124d51353 Fix #398 by ensuring proper usertype propagation. 2017-04-20 20:27:32 -04:00
ThePhD
3d5f80e35a Fix bad tag for clang 2017-04-19 15:29:26 -04:00
ThePhD
a3d6f8044c working stuff!~ 2017-04-19 13:00:47 -04:00
ThePhD
2acc8bee14 get_environment, documentation updates, and tests 2017-04-18 20:23:20 -04:00
ThePhD
36cc7f2863 crush the stack on final error when throwing to prevent 'leaks' in bad cases 2017-04-09 19:37:45 -04:00
ThePhD
a6e03ac214 tfw you break everything 'cause you're bad 2017-04-09 13:03:41 -04:00
ThePhD
2df532f79b There was a leak when running scripts and catching errors, where she didn't properly clean up the stack. 2017-04-09 12:04:57 -04:00
ThePhD
814562260d Fixes #394 2017-04-08 08:25:49 -04:00
ThePhD
28fff10637 Well, that bug was annoying to track down, but it was from the single.py script. This fixes #392 2017-04-06 21:15:22 -04:00
ThePhD
8c94cb730b Fix static initialization order fiasco with meta_function_names 2017-04-04 16:16:22 -04:00
ThePhD
185f5ecc05 new travis environments to be tested out for osx stuff, plus new_table docs and environments on function calls 2017-04-02 22:37:01 -04:00
ThePhD
309325d0f5 New feature: environment plus documentation about the environment table and its usage with scripts. 2017-04-02 16:10:00 -04:00
ThePhD
fb06c8a754 Fix slight error when error handler was called and the result wasn't properly moved. 2017-03-31 22:39:16 -04:00
ThePhD
91aff613bc Let's hope this isn't busted too 2017-03-31 17:59:55 -04:00
ThePhD
59b196a1db add a new kind of error handling script call, updating docs and examples 2017-03-31 17:38:04 -04:00
ThePhD
4094ba3e7a New feature: nested getter for complex nested tables, plus docs and example 2017-03-30 14:11:43 -04:00
ThePhD
791aecbcd0 New documentation for as_table and some container examples 2017-03-30 01:31:55 -04:00
ThePhD
e27922e844 Fix a latent herpderp from when I added new constructors to protected_function that resolves an ambigious implicit conversion. 2017-03-25 20:28:22 -04:00
ThePhD
3342e65b38 fixes to a lot of tests and proper subclassing for internal metatable data and work done to all of the usertypes to make them behave as expected 2017-03-23 21:13:46 -04:00
ThePhD
7c29964339 allow personal indexing function to catch rewrites to itself in usertypes statically and dynamically 2017-03-23 10:19:23 -04:00
ThePhD
a9644d0956 valid checks should be used only for non-stack-based objects: otherwise, stack things should appropriately trigger none of them and let the checker handle that portion of the code 2017-03-22 07:53:57 -04:00
ThePhD
44b4045343 change expression code so that it evalautes to a reference properly when throwing, otherwise VC++ will return a reference to a value it creates (thanks, VC++ extensions...) 2017-03-19 18:06:46 -04:00
ThePhD
ed6ae23d2e Accidentally put a critical check inside of a SOL_SAFE_USERTYPE define... Buh. 2017-03-16 10:12:17 -04:00
ThePhD
31b4dd820c silence some crap warnings and fix the inversion of the branches in the usertype metatable because I'm a dumb 2017-03-16 03:36:15 -04:00
ThePhD
21f59a997a The new constructor syntax was very easy to implement... 2017-03-16 03:07:20 -04:00
ThePhD
82482bfe3e one fix at a time... 2017-03-13 18:08:32 -04:00
ThePhD
b46901903d missed one 2017-03-13 18:03:01 -04:00
ThePhD
72fe0a5a31 remove std::move from items 2017-03-13 17:45:54 -04:00
ThePhD
30ecd7127a Tracking LuaJIT deletion bug, but it seems to be connected to the Hash Map iterator level...? Something is wrong, here... 2017-03-13 15:05:02 -04:00
ThePhD
84554c90ea VC++'s late instantiation killing me on things being used technically before they're defined, but being inside templates makes it bad... 2017-03-12 21:42:43 -04:00
ThePhD
dce8053248 Time to break everything.
Added the ability to extend all usertypes at runtime. The performance implications need to be examined closely.
variadic_args documentation was updated with the desired example demonstrating proper usage
usertype examples were updated demonstrating Lua runtime and C++ runtime updating of a usertype table
SOL_SAFE_FUNCTIONS is now part of the definitions and defined (thanks @eliasdaler)
2017-03-12 21:35:19 -04:00
ThePhD
ab9126d892 update customization points and track un-specialized structs to trigger some safe-guards as a back-compatible safety net 2017-02-20 18:07:02 -05:00
ThePhD
b7b63668c8 Ensure construction of special types in simple_usertype is working, and for regular usertype as well. 2017-02-20 03:44:41 -05:00
ThePhD
dde4aa64fc simple_usertype now responds with nil on bad lookups and sets items into place properly when new_index'd 2017-02-19 05:00:11 -05:00
ThePhD
a9cfe4b980 Fix ability to use call constructors for simple usertypes in a more systematic and thorough fashion (still some missing holes, but unlikely to ever encounter)
Add tests to make sure it never happens again
2017-02-18 21:59:31 -05:00
ThePhD
23e3f2c26d make sure member functions for simple usertypes propogate their desired type. 2017-02-17 05:46:39 -05:00
ThePhD
37420dcdc0 Documentation update about functions and new typedefs. 2017-02-16 02:05:49 -05:00
ThePhD
85194e0135 Fix leak issues and some ordering in state(view) move operations. Closes #336. 2017-02-15 05:42:44 -05:00
ThePhD
fe8b1c1c10 Bug in not properly keeping the observed valid table on the stack. 2017-02-01 06:54:30 -05:00
ThePhD
8d6f304bad Update the name table and make sure there are pairs and next metamethod entries. 2017-02-01 06:29:45 -05:00
ThePhD
c7deb82535 Improve performance by making wstring_convert objects static. Closes #326
Temporary warnings against alignment padding nonsense. Closes #325
Still need to test #324 and find out what's wrong with #327
2017-01-30 21:40:58 -05:00
RaptorFactor
c58d27e58d Work around clang-cl compilation issue. 2017-01-26 03:32:17 -08:00
Kim Byungsun
30feacb04e Fixed typo: luaxlib.h -> lauxlib.h 2017-01-14 07:44:23 -05:00
ThePhD
66ad189797 add functionality to have functions properly detected and the amount shifted over properly based on being a call constructor or not 2017-01-09 23:25:28 -05:00
ThePhD
490194f767 allow va_args to work with overloading, albeit things can get... bad, with it. Need to observe this more to make sure things don't go poorly. 2017-01-09 16:38:23 -05:00
ThePhD
658a11a2be forgot return type: update single 2017-01-07 01:11:03 -05:00
ThePhD
3baa99f941 thread and state awareness in all sol lua types 2017-01-07 00:40:44 -05:00
ThePhD
010b6bb101 allow for switch to change Lua configuration and build with assumptions to C++ handling 2017-01-02 09:36:04 -05:00
The Phantom Derpstorm
a2691c6570 Merge pull request #304 from davedissian/develop
Correct the LuaJIT 2.1.0 condition
2016-12-26 14:01:08 -05:00
ThePhD
26b85c8136 Make sure resolve works and provide some protection against deleting the handler that originates from a specific sol::state. sol::state_view users will be left out in the dark, though. 2016-12-26 13:50:08 -05:00
David Avedissian
9382ceb1b5 Correct the LuaJIT 2.1.0 condition 2016-12-25 13:21:13 +00:00
ThePhD
3aa42c5db8 update single 2016-12-16 05:31:32 -05:00
FYP
b1af00f048 fix thread_status::dead value for luajit 2016-12-16 12:20:28 +03:00
ThePhD
428adf706f optional impl alignment requirements?? Thanks, Emscripten. 2016-12-16 01:00:49 -05:00
ThePhD
e1329d244a Fix alignment issues with optional implementation
Update single.py to look at toplevel file rather than listing out all base sources
string_shim didn't have the proper header
Improve gitignore
2016-12-16 00:31:45 -05:00
ThePhD
ad010adcad Goddamn unused parameters... 2016-12-10 05:56:10 -05:00
ThePhD
f4f3bffe2f Oh boy, more simplicity functions...! 2016-12-10 01:19:23 -05:00
ThePhD
edeb81a7e1 Add registry constructors to tug things right out of the registry, and add a main_thread getter to aid in Joynet dev 2016-12-10 00:25:25 -05:00
ThePhD
16152c7faf Make various arguments push based on the Lua state passed, not on the Lua state they have (avoids a small class of errors and makes the panic function call tiself more regularly). 2016-12-06 10:51:14 -05:00
ThePhD
7628c635bd Memory leak fix! 2016-12-05 12:03:15 -05:00
ThePhD
d0a36c9657 objc define to keep code clean on that platform 2016-12-03 07:33:18 -05:00
ThePhD
20b951d551 we choose nil serialization for bad stack pushes 2016-12-02 05:47:24 -05:00
ThePhD
0d43a6f22b fix const-correctness error in detection of is_container type 2016-11-29 12:51:21 -05:00
ThePhD
433e34cd9b as_args and threading API cleanliness. 2016-11-26 13:58:06 -05:00
ThePhD
7b63057ba8 PRAISE BASED EEVEE 2016-11-26 03:32:28 -05:00
ThePhD
289ded358c -Wshadow and -Wconversion are kind've dumb 2016-11-25 20:47:15 -05:00
ThePhD
49a0f71272 library fixes 2016-11-23 02:55:25 -05:00
ThePhD
b40f895fd4 Fix double-delete crash that could also be affecting @IronsDu 2016-11-23 02:39:52 -05:00
ThePhD
97cafbaadd Default error handler function for protected_function 2016-11-17 23:58:24 -05:00
ThePhD
57c933cc9b bitfield example and link in docs 2016-11-15 22:45:34 -05:00
ThePhD
fe162b9643 make sure protect works as advertised 2016-11-15 04:39:42 -05:00
ThePhD
b2d137f65f change resolve to behave better with crappy clang 2016-11-14 21:39:26 -05:00
ThePhD
f5930bfa48 constexpr resolve 2016-11-14 13:58:55 -05:00
ThePhD
1461ab780c Fix an idiot derp in the code
and stop having sleep attacks...
2016-11-14 13:42:55 -05:00
ThePhD
22e17eb9fd Correct spelling is hard. 2016-11-13 04:21:24 -05:00
ThePhD
fbc0fc5f93 Properly word the exception documentation and made some proper links.
Update single and use proper wording.
2016-11-13 03:48:22 -05:00
Anand Aiyer
6e6cb675e2 SOL_LUAJIT_FULL_INTEROPERABILITY - If you are using a platform and
compiler that has full c++ exception interoperability
(http://luajit.org/extensions.html#exceptions), define
SOL_LUAJIT_FULL_INTEROPERABILITY. This will prevent sol from catching
(...) errors - in platforms & compilers than have full c++ exception
interoperability Lua errors can be caught with catch (...) in C++ - in
these cases sol inaccurately prevents Lua errors from being propagated
correctly.
2016-11-13 12:02:29 +05:30
Anand Aiyer
951b821272 missing ';' when SOL_NO_EXCEPTIONS is enabled 2016-11-13 11:22:54 +05:30
ThePhD
02bbe0c528 improve docs heavily 2016-11-11 12:44:34 -05:00
ThePhD
4116db8c89 Add heavy support for all things array and list and stuff 2016-11-09 07:42:45 -05:00
ThePhD
3b4dd52caf Fix is_container derp that triggered fault construction of pointer types 2016-11-07 13:52:20 -05:00
ThePhD
f8705202e2 Update single and update safe usertype checking 2016-11-06 16:34:05 -05:00
ThePhD
1c73fb054b std::cend doesn't exist in older compiler versions... 2016-11-05 23:25:46 -04:00
ThePhD
3e77a77ddc fix container usertype metatables 2016-11-05 23:04:32 -04:00
ThePhD
52f69a2653 Heavily improve documentation and add new container functions. 2016-11-05 20:08:07 -04:00
ThePhD
d863a56760 Weee, script return value tests 2016-11-02 19:00:16 -04:00
ThePhD
9836aba51d octal constants suck =/ 2016-11-01 19:24:59 -04:00
ThePhD
0a165dc5b4 Sometimes? You just don't like C++. At all. 2016-11-01 06:03:54 -04:00
ThePhD
c2c9ccf89c constexpr? More like LULexpr. 2016-11-01 05:57:48 -04:00
ThePhD
d3cb9042c3 Heey, no more submodules needed now. 2016-11-01 05:39:44 -04:00
ThePhD
1213c8959a Ditch the dependency on the optional submodule, nobody's ever gonna care about it... 2016-11-01 05:31:59 -04:00
ThePhD
c9728b7e27 do_string / do_file synonyms. I have to document all this... 2016-10-30 05:56:56 -04:00
ThePhD
0859af3203 Fix comparisons done of improper types 2016-10-30 04:40:17 -04:00
ThePhD
f896a9ea16 Pop errors off the stack if they're present. 2016-10-29 15:12:47 -04:00
ThePhD
5193db55c3 allow for not-containers to be specified
Make sure tables of various sizes are kept working
2016-10-28 04:36:04 -04:00
ThePhD
85329ca183 Mmn. Always making lots and lots of small changes. 2016-10-23 19:17:33 -04:00
ThePhD
2ac711b7f8 fix static initializer bugs from crap -- and remember to hunt down and get rid of all non-constexpr things like it in the future... 2016-10-21 17:32:27 -04:00
ThePhD
a65f795b79 ipairs and pairs improved support, folding the registration table down to avoid duplicated code 2016-10-21 07:05:58 -04:00
ThePhD
661e361b26 inline pls 2016-10-15 18:53:42 -04:00
ThePhD
391f29afb1 Oh boy, new compatibility files...! 2016-10-15 18:36:30 -04:00
ThePhD
940f44db55 Add presentation from Lua Workshop 2016
Have proper detection for numbers (even if it comes at a higher cost)
2016-10-15 18:14:19 -04:00
ThePhD
c2d219ea7d Reworked the architecture of usertype functions to include a shim table between it and the actual metatables.
This means that usertype tables visible in the code and bound to the name specified with `new_usertype` and friends will be normal tables, and those tables delegate their responsibilities to the 3 backend tables of `sol.unique_usertype<T>`, `sol.T`, and `sol.T*`. This separation allows for a few caveats for updating and overriding members of `new_simple_usertype` tables to 'just work' without any serious hassle, and to have a single point that lets up decide how to perform updates properly. It also restores an optimization we had to turn off by ham-fisting whether ot not indexing was turned on the usertype metatables themselves.

o wow wow wow it's such a nice commit message look at how organized it is
PFFFFFFFFFF.
2016-10-11 05:58:49 -04:00
ThePhD
e0e376a370 -1 size key is bad: remember to add this to presentation... 2016-10-05 20:55:40 -04:00
ThePhD
0ba4650c64 Another example, constness derp fix 2016-10-05 20:39:49 -04:00
ThePhD
009d6b0fa9 Fix protected_function shenanigans, hopefully for good. 2016-10-04 23:37:08 -04:00
ThePhD
4ac35aa8f4 sometimes, I have a dumb. Othertimes, the lua docs are sneaky and have subtle maybe-behaviors when other parts of their API never do. Sneaky, sneaky API... 2016-10-02 13:37:52 -04:00
ThePhD
23c2c6dedc weee slight fix and doc update 2016-10-01 18:19:35 -04:00
ThePhD
b05ce97247 Allllll the fixes. All the time. Mostly to make sure constructors don't fight with each other and safety is respected. And documentation updates. 2016-10-01 01:27:40 -04:00
ThePhD
6c34a2ac4f updated protected_function stuff 2016-09-30 01:42:23 -04:00
ThePhD
72a445ff6a Some minor fixes and updates 2016-09-29 03:29:48 -04:00
ThePhD
cbe599a901 Referential transparency is important. 2016-09-28 19:05:26 -04:00
ThePhD
d7b037da73 Sigh. Make sure that tuple expansion works in buggy VC++ compiler. 2016-09-26 04:02:03 -04:00
ThePhD
d88db0faff Buh. Capturing the right semantics is always hard. 2016-09-22 11:49:29 -04:00
ThePhD
3a00ce0adf Some minor fixes and DOCS AND EXAMPLES WOOoOooOOooOoo 2016-09-22 07:13:04 -04:00
ThePhD
9d52ed49ba balance that stack, goddamnit, BALANCE IT 2016-09-19 23:37:00 -04:00
ThePhD
8c9c662d97 Truly, I am a spectacular idiot... 2016-09-19 01:17:58 -04:00
ThePhD
89107d3b90 Fix crashing of simple usertypes from a previous herpderp. 2016-09-19 00:36:50 -04:00