Commit Graph

443 Commits

Author SHA1 Message Date
ThePhD
673fc3a6fa loadfilex doesn't exist... nice. 2016-04-23 17:16:56 -04:00
ThePhD
f37eedd6c2 reverse_iterator 2016-04-23 17:13:49 -04:00
ThePhD
006357430b Shiny quick 'n' dirty tutorial -- variadic_args now is iterable -- fixed bug with transparent args in overload resolution -- added load functions 2016-04-23 17:07:51 -04:00
ThePhD
69ad2b4c71 better static assert 2016-04-22 17:59:44 -04:00
ThePhD
1b6062404b Demangling will kill us one day. 2016-04-22 17:39:54 -04:00
ThePhD
2cfe74cc7f Better demangling
Userdata pushed before the usertype is pushed will not latch onto the new metatable if its added
Updated tests
2016-04-22 17:06:56 -04:00
ThePhD
96da27d565 Ensure argument transparency. 2016-04-18 08:27:30 -04:00
ThePhD
062d2281d5 bit32 was deprecated, apparently. Lovely. 2016-04-17 21:14:33 -04:00
ThePhD
9872c67b4f jit lib and all 2016-04-17 21:00:24 -04:00
ThePhD
4123830e6c Should probably introduce a is_push_pop_transparent trait for things like is_this_state ... 2016-04-17 03:13:46 -04:00
ThePhD
4e029b7a00 -.- Macros. 2016-04-17 02:32:51 -04:00
ThePhD
90ea495d4c "constexpr" my ass. 2016-04-17 02:26:18 -04:00
ThePhD
88155d44e0 sol::property is implemented for usertypes now
sol::this_state is  a transparent argument that gets the current state at any position in any callback
sol::variadic_args allows a person to get something that can reference the "rest of the arguments", though it doesn't enforce that it has to be the last argument

Closes #57
Closes #59
Closes #60
2016-04-17 02:18:34 -04:00
ThePhD
f10988363c implicit conversion operator to make using the framework easier. 2016-04-11 18:07:25 -04:00
ThePhD
42f4455383 Allow for "static functions" to be registered on userdata like other parts of the framework, as well as self-contained structs and lambas.
sol::readonly for the ability to make a variable set on a userdata readonly.
No support for property yet: put on issues list for later
2016-04-11 01:02:43 -04:00
ThePhD
16007fa792 Documentation update, get_or for proxies, and other goodies. 2016-04-09 00:55:12 -04:00
ThePhD
4cdcac2001 Ensure compilation for 2 more function types 2016-04-07 05:43:44 -04:00
ThePhD
9734577fdb stack implementation, plus reference semantics within lua for usertypes/data now.
I hate my life.
I hate the projects I'm working on.
Closes #53
Closes #56
Closes #52
2016-04-07 05:21:49 -04:00
ThePhD
204bd5d5ed This adds the additional safety features. stack_guard should probably be migrated into the tests too, since a lesser form is already used there.
Closes #54 #55
2016-04-04 02:28:39 -04:00
ThePhD
5efbae5798 Is pedantic safe to turn on? TIME TO FIND OUT. 2016-04-02 09:11:44 -04:00
ThePhD
c087ca30bf .-. good thing we have travis CI 2016-03-31 16:33:21 -04:00
ThePhD
8862c65f0a NOW we're truly feature complete. Sheesh, the work that this requires.... 2016-03-31 16:16:07 -04:00
ThePhD
2d14cedc17 Eat shit, std::tuple 2016-03-31 12:12:04 -04:00
ThePhD
7af3fc4ffa Added nullopt pushing, optional pushing, improved tests 2016-03-30 16:52:51 -04:00
ThePhD
a683d615a5 compat for g fucking libgarbage 2016-03-30 03:33:44 -04:00
ThePhD
623f83547d Enumeraatiions... 2016-03-30 03:25:22 -04:00
ThePhD
3f753b55b9 Enumeration warnings 2016-03-30 03:24:07 -04:00
ThePhD
3abcf7f086 Fuck you, clang: http://stackoverflow.com/a/8629943/5280922 2016-03-30 03:08:53 -04:00
ThePhD
2826a1f8c0 unused q_q 2016-03-30 02:21:52 -04:00
ThePhD
2ee9967cdd More unused parameters. .-. 2016-03-30 02:16:08 -04:00
ThePhD
20c4fee60e unused parameter derp 2016-03-30 02:07:09 -04:00
ThePhD
92c388e30a And nooow we're set for optional. Totally. With the get_or implementation as well. Hopefully this will be all we need. 2016-03-30 01:40:40 -04:00
ThePhD
9804d7dd63 Merge remote-tracking branch 'zwparchman/develop' into develop 2016-03-30 00:34:05 -04:00
ThePhD
5acb33e2bc full-on optional support. so much support it's coming through my eyeballs. Goodness.
Support for c_call wrapper to be a thing.
2016-03-30 00:31:18 -04:00
Zachary
6637f2e1b7 Added table::get_with_default method
There is now a sol::table::get_with_default method that takes 2
arguments, one being the key to search on, the other being the default.
If the key does not have a value in the table the default value is
returned.
2016-03-29 13:03:19 -05:00
ThePhD
a0fdaaaa7d Full-on optional support. 2016-03-25 10:39:54 -04:00
ThePhD
7efc577eea Meow. 2016-03-25 05:43:37 -04:00
ThePhD
9aabf71896 Off by one errors .-. 2016-03-25 05:38:09 -04:00
ThePhD
68660a1bed Allow for checking whether or not a given proxy is valid. 2016-03-25 05:27:19 -04:00
ThePhD
4f99b99ee9 Properly directly include optional and reference it in C++17 and beyond. 2016-03-24 15:51:04 -04:00
ThePhD
09a0a5051a Documentation updates and new stack::check_get API. 2016-03-24 15:45:44 -04:00
ThePhD
f43adf9a3d Additional function creation tables and tests to keep them there. 2016-03-15 07:32:59 -04:00
ThePhD
c3bf2e04f8 I really don't like clang. 2016-03-15 06:45:49 -04:00
ThePhD
d52bc23f53 Mooooar tests. And better support for proxy and tuples. 2016-03-15 06:36:25 -04:00
ThePhD
3534bc222c proxy is now pushable, making it usable with functions 2016-03-15 05:20:56 -04:00
ThePhD
20d85850ea Ha ha haaa I forgot std::pair is a tuple-like type .-. 2016-03-14 18:33:10 -04:00
ThePhD
83ec159da1 Bwuh. 2016-03-14 17:19:43 -04:00
ThePhD
0c42c203c9 I program well, I swear. .-. 2016-03-14 17:12:03 -04:00
ThePhD
3de38f8da1 Easier access to specific functions. 2016-03-14 16:10:08 -04:00
ThePhD
97e36f70c5 Alright, NOW everything's kosher. Bwuh, byte order marks... 2016-03-14 09:53:24 -04:00
ThePhD
53c8961a20 Merge remote-tracking branch 'origin/develop' into develop 2016-03-14 02:34:28 -04:00
ThePhD
62f082d999 documentation fixes from feedback and fixes! 2016-03-14 02:34:02 -04:00
Patrik Huber
540926d9f4 Removed stray <feff> byte order mark
This fixes compiling with clang on msys2. I believe you saved these files as UTF16 once or something and these byte order marks were added by an editor.
The PR leads to the line "// The MIT License (MIT)" to no longer be present in the single-header sol.hpp at 3 occasions, but I think they were there by mistake anyway and should've been stripped by the python script, but didn't, because of the BOM. So this actually fixes that as well.
2016-03-14 00:54:23 +00:00
ThePhD
d3ccfa7426 Primetime 2016-03-13 10:03:05 -04:00
ThePhD
7f40c4edb6 Clang errors because 2 phase lookup is stupid between compilers. 2016-03-13 08:41:29 -04:00
ThePhD
c42c1bafe5 Documentation fixes, new tests, unique/shared_ptr support.
Closes #32
2016-03-13 08:30:14 -04:00
ThePhD
d8bc6c8612 Unfortunately have to use tag dispatched types because Clang's a piece of shit. 2016-03-11 18:41:44 -05:00
ThePhD
338278edf7 The docs are here. 2016-03-11 17:47:15 -05:00
ThePhD
7f7c51ae33 Forgot userdata and table_iterator files. 2016-03-11 11:36:13 -05:00
ThePhD
1a9c7484b1 Fix up the API; prepare for release. 2016-03-11 11:34:44 -05:00
ThePhD
5d722af1b0 Because bwuh. 2016-03-05 02:42:19 -05:00
ThePhD
e417d5ce87 forgot inheritance file 2016-03-05 01:50:17 -05:00
ThePhD
19578538e7 Inheritance 2016-03-05 01:43:45 -05:00
ThePhD
22f74a31a2 Catch EVERYTHING, even the shit we don't know about. 2016-03-03 03:16:59 -05:00
ThePhD
e06b939d73 pre-empty luajit exception handlers (turns out we really need it) 2016-03-02 21:14:58 -05:00
ThePhD
29dacd819e new files for protected functions and its results. Allows for better doc writing. 2016-03-02 21:02:12 -05:00
ThePhD
923c774d5e ability for functions that throw not bound by sol to catch and return lua errors that can be used by a handler function (for protected function). 2016-03-02 20:45:52 -05:00
The Phantom Derpstorm
3534be0641 Merge pull request #25 from Nava2/fix-multisymbol-luajit51
For some reason, on luajit5.1 these needed to be inline
2016-03-02 10:08:47 -05:00
ThePhD
ba36b1a410 Type names 2016-03-02 10:03:00 -05:00
ThePhD
c01f15ca95 g++ makes me sad 2016-03-02 09:51:40 -05:00
ThePhD
17c1dde68e Do exceptions better 2016-03-02 09:36:42 -05:00
ThePhD
b24d17df31 Allow for exceptions to not be used. 2016-03-02 08:44:07 -05:00
Kevin Brightwell
b361780900 For some reason, on luajit5.1 these needed to be inline 2016-03-02 01:11:53 -05:00
ThePhD
4ed197f065 formatting 2016-02-27 08:04:02 -05:00
ThePhD
0113fb86b4 fix parse error with g++ 2016-02-27 08:01:48 -05:00
ThePhD
d42efd7fdf Proper trampolines to allow luajit to play nice with all the other kids in sol. 2016-02-27 07:56:28 -05:00
ThePhD
e57ac87868 Unused parameters and all that jazz.... 2016-02-27 02:59:47 -05:00
ThePhD
c07bbd248c Formatting and a few new constants. 2016-02-27 02:49:40 -05:00
ThePhD
251e350539 coroutines \o/ 2016-02-27 02:43:53 -05:00
ThePhD
1341aafa27 Unfortunately, exceptions require some overhead in luajit... overhead we can't always accept on behalf of the user. 2016-02-25 13:04:04 -05:00
ThePhD
7402b1bc95 Clearer names for some of the exposed classes. 2016-02-25 11:07:39 -05:00
ThePhD
9c21d11b8c Proper defaults for bootstrap.py
Checks in g++ to make sure things compile
clang++ is a major asshole...
2016-02-24 13:59:17 -05:00
ThePhD
3d7a93ae1c Put detail classes not part of the interface into deeper namespaces to clear up the to level. 2016-02-23 23:39:46 -05:00
ThePhD
16c6f62fe3 Remove strerror deprecation remark 2016-02-22 02:44:27 -05:00
ThePhD
166771ae8d Proper support for mixed types of overloads. 2016-02-21 21:27:05 -05:00
ThePhD
a6a2e67dc6 Git had a sneeze and couldn't properly remove this file... 2016-02-21 19:28:30 -05:00
ThePhD
019c7b037b Huge improvements to the library and fixes to compile in g++.
usertype now respects factory functions and does not make default constructors/destructors unless the compiler says its okay
new and __gc functions can be overridden for usertypes to provide handle-like creation and deletion functions
Overloading match fixes
RAII improvements for all usertypes
Added tests to make sure these features stay
2016-02-21 19:26:58 -05:00
ThePhD
b2b73db5cb overloading searching improvements and general refactoring for cleaner implementation. 2016-02-18 22:17:52 -05:00
ThePhD
0ee92c0142 This is hard.... 2016-02-16 21:22:07 -05:00
ThePhD
f62c53f155 x64 build fixes 2016-02-15 09:24:59 -05:00
ThePhD
1293213775 Several improvements to tunnneling for the library, with included tests
Some stack size tests are also included to prevent stack overflow as well.
2016-02-13 20:14:31 -05:00
ThePhD
228609ee17 Addresses derp from refactoring and #12 2016-02-12 12:47:05 -05:00
ThePhD
a71c9737d4 Fixed usertype checking for overloading resolution (and for userdata in general) 2016-02-11 02:28:38 -05:00
ThePhD
427194bc92 Improved functions example and adjusted all errors for g++ conformance with -Wall -Werror 2016-02-10 12:12:09 -05:00
ThePhD
2788abb34e Overloading now works and there are tests to back it up. The codebase now relies on some C++14 features explicitly. 2016-02-10 11:36:00 -05:00
ThePhD
9372b54b02 Preparing for overload support
Preparing to benchmarking of several different lua frameworks
2016-02-09 03:38:11 -05:00
ThePhD
5034bd7980 Benchmarking will be done in a separate repository, alongside other frameworks. 2016-02-04 20:16:53 -05:00
ThePhD
bb29127785 Proper semantics for set/get
`set_function`/`set_usertype` now properly use `set`
For the time being, we are going to avoid implementing `traverse`; aside from performance of nested table access (e.g. `int x = lua["a"]["b"]["c"]`), it's a pain. ;~;
2016-02-02 16:18:44 -05:00
ThePhD
b66c7f015a Significant change to how userdata is stored to make access consistent across values/references/pointers. 2016-02-01 11:56:44 -05:00
ThePhD
1d93f560f2 more luajit compatibility fixes - works with Lua 5.1, 5.2, 5.3
additional tests to make sure pass-by-value and copy semantics work as intended
new proxy_base class to reduce code duplication
update function / protected_function usage (to solve starwing's issue while keeping code as clean as possible)
2016-02-01 03:27:06 -05:00
ThePhD
27f09fbb35 variadic set - introduction of state_view type to allow for all of the benefits of state without destructing lua instance. 2016-01-30 04:21:33 -05:00
ThePhD
f21f9c9959 Ensures value semantics and proper destructor calls.
Fixes for tabs/spaces
2016-01-28 19:57:02 -05:00
ThePhD
f389c7fe36 True luajit compatibility 2016-01-27 01:07:16 -05:00
ThePhD
31e7857870 Merge remote-tracking branch 'root/develop' into develop
# Conflicts:
#	examples/usertype.cpp
#	sol.hpp
#	sol/debug.hpp
#	sol/default_construct.hpp
#	sol/demangle.hpp
#	sol/deprecate.hpp
#	sol/error.hpp
#	sol/function.hpp
#	sol/function_types.hpp
#	sol/object.hpp
#	sol/proxy.hpp
#	sol/reference.hpp
#	sol/resolve.hpp
#	sol/stack.hpp
#	sol/state.hpp
#	sol/table.hpp
#	sol/traits.hpp
#	sol/tuple.hpp
#	sol/types.hpp
#	sol/usertype.hpp
#	sol/usertype_traits.hpp
2016-01-24 12:16:38 -05:00
ThePhD
7c7f862cb4 fixed proxy (perhaps I broke it recently?) 2016-01-24 09:19:36 -05:00
ThePhD
8c9f8c3341 improved benchmarking 2016-01-16 02:30:49 -05:00
ThePhD
48e2c82203 benchmarking is... way too hard, truly. 2016-01-10 20:36:37 -05:00
ThePhD
9ff968a09b Heavily improved benchmark and first set of optimizations to sol/table.hpp, providing much lower access times for calling a function. 2016-01-08 16:16:06 -05:00
ThePhD
cc0caf365a Version less than 5.2, (5.1 an below) not less than 5.3 (thanks Aezriel!) 2015-12-01 15:00:16 -05:00
ThePhD
a69c599f99 Ensure proper semantics for default error handler 2015-11-02 08:10:29 -05:00
ThePhD
3e17b24065 static members are hard to deal with in regular memory...
Also, make sure tuple returns don't get shafted by the tuple_types machinery!
2015-10-25 07:44:17 -04:00
ThePhD
4b545aa6a2 Fix tuple returns (they don't need to be explicitly expanded in many cases). 2015-10-25 07:17:48 -04:00
ThePhD
e84cf66683 decay to std::string instead of char*, as its both safer (protects against early stack pops) and is handled better by g++'s new std::string conversion constructors
Make sure we're only using C++11 features (no decltype(auto))
2015-10-25 06:48:19 -04:00
ThePhD
34af96214b tests for the lua call error handling functions... 2015-10-23 02:54:26 -04:00
ThePhD
8f59cf2eee Set the ability to give your own panic function 2015-10-22 21:53:12 -04:00
ThePhD
42a03a2618 proper default error handler 2015-10-22 21:46:40 -04:00
ThePhD
ad039c8cc2 Allow for usage of function error handlers with lua
TODO: make this the default mode, with a short-cutting mode (sol::no_fail_function?)
2015-10-22 11:20:32 -04:00
ThePhD
7f4d8d8f89 Allow for failed function calls from lua. 2015-10-22 06:49:53 -04:00
ThePhD
93fe7443f0 Solve's @starwing's problem with not having the ability to check if a function call succeeded or not. 2015-10-22 06:10:30 -04:00
ThePhD
93d532094e object is now more flexible while still supporting the same semantics
indentation an spacing fixes for everything
2015-10-20 21:38:28 -04:00
ThePhD
8e0cc99215 Seems like there's no more optimizations that can be made to sol/function...
Only other thing to optimize is `usertype`, maybe.
2015-09-29 18:19:07 -04:00
ThePhD
895030c69e Remove whorish return_forward. 2015-09-07 10:43:39 -04:00
ThePhD
dbeb8b5fcb tests for the new decaying functionality
need to test with clang++/g++ to see if it still works
2015-07-22 02:54:43 -04:00
Rapptz
38d03eef6e Update copyright year. 2015-07-21 19:51:17 -04:00
ThePhD
0460b33d6c properly use decltype and throw out the get_return "type trait". It wasn't very useful anyhow. 2015-07-21 19:34:48 -04:00
ThePhD
946d01d228 Always reuse functions, avoid duplicate code... 2015-07-20 20:28:10 -04:00
ThePhD
219d10b0b4 Thanks to LUA_MULTRET, we can have normal function call syntax with sol::function that doesn't require the user to pass the arguments in directly with .call<Return1, Return2, Return3>( ... )
function result is meant to be transient, and therefore should not be regularly storeable by the user... but there is no way to make a "and you can't have anything but a temporary to this" type, as far as I can tell.
2015-07-19 10:26:11 -04:00
ThePhD
1b8bc7c1e9 cxxabi include should not be used on VC++ 2015-07-11 05:28:06 -04:00
ThePhD
9a0dda1f3d Fix VC++ warning 2015-07-09 18:18:34 -04:00
ThePhD
feefb4859f Oh, tabs. Oh, you... 2015-07-07 01:41:36 -04:00
ThePhD
6a16a5a482 Some quick fixes and harmless polishes for the compat layer in state.hpp 2015-07-07 00:31:50 -04:00
ThePhD
069a209a4e Fixes for the g++/clang builds 2015-06-18 10:53:21 -04:00
ThePhD
ffcd1f557b Some derps on the compatibility arguments
checkargs is now properly propogated through the "call" functions
tests now define SOL_CHECK_ARGUMENTS to make sure
the tests will always check arguments now as well (caught one minor implementation detail missing from that!)
2015-06-17 18:33:58 -04:00
ThePhD
8ff921a247 A messed up space. 2015-06-17 16:53:46 -04:00
ThePhD
e70a3c945e Macro activates the library's default argument checking. Useful to verify during tests and the like. 2015-05-27 02:48:07 -04:00
ThePhD
74677a9125 RIP tabs. 2015-05-27 02:28:31 -04:00
ThePhD
712afc924f Conversions from nil to nullptr and vice-versa now properly work
Fix for really bad derp in metamethod registration
2015-05-27 02:23:37 -04:00
ThePhD
b8d81cb927 partial implementation of lua_version...
It's a bit more reliable than before, but... not really that much better!
2015-05-24 23:31:18 -04:00
ThePhD
8b13e6df6f Fix tab derps. 2015-05-24 21:38:39 -04:00
ThePhD
184f16d7fa Updated copyright headers and added compatibility with lua 5.1.5 and luajit!
This means sol can now run on the fastest dynamic language implementation ever!
Wooo!~
2015-05-24 21:29:21 -04:00
ThePhD
e816d07121 Standard-compliant function signature deduction (cannot use set_function<Args...> format as that creates an ambiguity)
state now has for_each (runs on global table like all other functions)
added for_each tests, per @Rapptz request
2015-05-15 22:26:18 -04:00
ThePhD
1792259685 Fix tabs. 2015-05-15 12:43:53 -04:00
ThePhD
542d2a813e new table.for_each while iterators get sorted out 2015-05-15 12:41:45 -04:00
ThePhD
bd4492b85b This mega-commit introduces Visual Studio 2015 CTP 6 support.
sol::object had a few reference leaks in the way it retrieved values: it now does it properly without leaving the stack at +1 item
sol::stack was drastically cleaned up, with the following key change:
    * sol::stack::push now returns an integer of the number of things its pushed (usually 1, but can be more) (Thanks, @PrincessNyanara!)
    * sol::stack::call now calls functions flexibly, and getting is done more reliably
    * due to the innovation of stack::call and using absolute indices, we no longer have to use reverse_call style programming to deal with lua
    * sol::reference::get_type is now const-correct
    * sol::state and sol::table now have a cleaned up `get` implementation since it is no longer held back by the ugliness of VC++'s incapability to handle templates
    * the name `sol::userdata` now belongs to a type that actually encapsualtes a void* with a pusher/getter than gets a userdata void* value (TODO: give it a template to make it static_cast to that type on get?)
    * lightuserdata_t -> light_userdata, upvalue_t -> upvalue as type names (mostly details)
    * pushers for various types were updated to return integers
2015-03-01 21:14:42 -05:00
ThePhD
fa8416168e Merge remote-tracking branch 'root/master' into api-fix
Conflicts:
	sol/function_types.hpp
2015-02-28 18:21:39 -05:00
ThePhD
0cfcadb7eb Prevent null string return from causing undefined behavior. 2014-12-17 16:57:14 -05:00
ThePhD
8a4595dc80 Merge branch 'master' into api-fix 2014-12-17 16:24:53 -05:00
ThePhD
99424524f3 Remove unused parameter warning. 2014-10-30 13:17:52 -04:00
ThePhD
699ae140c8 Use 2 string types to properly filter bad name-based usertype overloads. 2014-09-29 23:10:33 -04:00
ThePhD
a217fa5c7a Proper deprecation to alert users to API name changes. 2014-09-29 23:10:32 -04:00