|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 27-Oct-2020 | - |
| docs/ | H | 27-Oct-2020 | - | 6,533 | 4,451 |
| examples/ | H | 27-Oct-2020 | - | 1,437 | 949 |
| single/sol/ | H | 27-Oct-2020 | - | 13,161 | 10,659 |
| sol/ | H | 27-Oct-2020 | - | 14,950 | 11,123 |
| .gitignore | H A D | 27-Oct-2020 | 760 | 74 | 64 |
| .travis.yml | H A D | 27-Oct-2020 | 5.1 KiB | 193 | 175 |
| CONTRIBUTING.md | H A D | 27-Oct-2020 | 1.9 KiB | 59 | 40 |
| README.md | H A D | 27-Oct-2020 | 3.9 KiB | 85 | 61 |
| bootstrap.py | H A D | 27-Oct-2020 | 8.2 KiB | 207 | 156 |
| install.deps.sh | H A D | 27-Oct-2020 | 2.1 KiB | 97 | 67 |
| ninja_syntax.py | H A D | 27-Oct-2020 | 5.3 KiB | 157 | 119 |
| single.py | H A D | 27-Oct-2020 | 5.1 KiB | 166 | 109 |
| sol.hpp | H A D | 27-Oct-2020 | 2.4 KiB | 66 | 37 |
| test_containers.cpp | H A D | 27-Oct-2020 | 12.2 KiB | 493 | 416 |
| test_coroutines.cpp | H A D | 27-Oct-2020 | 1.4 KiB | 64 | 55 |
| test_customizations.cpp | H A D | 27-Oct-2020 | 2.1 KiB | 87 | 60 |
| test_functions.cpp | H A D | 27-Oct-2020 | 28.5 KiB | 1,067 | 873 |
| test_inheritance.cpp | H A D | 27-Oct-2020 | 5.7 KiB | 249 | 197 |
| test_operators.cpp | H A D | 27-Oct-2020 | 1.8 KiB | 83 | 73 |
| test_overflow.cpp | H A D | 27-Oct-2020 | 1.1 KiB | 48 | 41 |
| test_simple_usertypes.cpp | H A D | 27-Oct-2020 | 9.7 KiB | 464 | 385 |
| test_stack_guard.hpp | H A D | 27-Oct-2020 | 273 | 12 | 10 |
| test_storage.cpp | H A D | 27-Oct-2020 | 791 | 35 | 30 |
| test_strings.cpp | H A D | 27-Oct-2020 | 4.6 KiB | 123 | 98 |
| test_tables.cpp | H A D | 27-Oct-2020 | 13.9 KiB | 549 | 457 |
| test_usertypes.cpp | H A D | 27-Oct-2020 | 34.1 KiB | 1,495 | 1,229 |
| tests.cpp | H A D | 27-Oct-2020 | 19 KiB | 795 | 627 |
README.md
1## Sol 2.15
2
3[![Join the chat at https://gitter.im/chat-sol2/Lobby](https://badges.gitter.im/chat-sol2/Lobby.svg)](https://gitter.im/chat-sol2/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
5[![Build Status](https://travis-ci.org/ThePhD/sol2.svg?branch=develop)](https://travis-ci.org/ThePhD/sol2)
6[![Documentation Status](https://readthedocs.org/projects/sol2/badge/?version=latest)](http://sol2.readthedocs.io/en/latest/?badge=latest)
7
8Sol is a C++ library binding to Lua. It currently supports all Lua versions 5.1+ (LuaJIT 2.x included). Sol aims to be easy to use and easy to add to a project.
9The library is header-only for easy integration with projects.
10
11## Documentation
12
13Find it [here](http://sol2.rtfd.io/). A run-through kind of tutorial is [here](http://sol2.readthedocs.io/en/latest/tutorial/all-the-things.html)! The API documentation goes over most cases (particularly, the "api/usertype" and "api/proxy" and "api/function" sections) that should still get you off your feet and going, and there's an examples directory [here](https://github.com/ThePhD/sol2/tree/develop/examples) as well.
14
15## Sneak Peek
16
17```cpp
18#include <sol.hpp>
19#include <cassert>
20
21int main() {
22 sol::state lua;
23 int x = 0;
24 lua.set_function("beep", [&x]{ ++x; });
25 lua.script("beep()");
26 assert(x == 1);
27}
28```
29
30```cpp
31#include <sol.hpp>
32#include <cassert>
33
34struct vars {
35 int boop = 0;
36};
37
38int main() {
39 sol::state lua;
40 lua.new_usertype<vars>("vars", "boop", &vars::boop);
41 lua.script("beep = vars.new()\n"
42 "beep.boop = 1");
43 assert(lua.get<vars>("beep").boop == 1);
44}
45```
46
47More examples are given in the examples directory.
48
49## Presentations
50
51"A Sun For the Moon - A Zero-Overhead Lua Abstraction using C++"
52ThePhD
53Lua Workshop 2016 - Mashape, San Francisco, CA
54[Deck](https://github.com/ThePhD/sol2/blob/develop/docs/presentations/ThePhD%20-%20No%20Overhead%20C%20Abstraction%20-%202016.10.14.pdf)
55
56## Creating a single header
57
58You can grab a single header out of the library [here](https://github.com/ThePhD/sol2/tree/develop/single/sol). For stable version, check the releases tab on github for a provided single header file for maximum ease of use. A script called `single.py` is provided in the repository if there's some bleeding edge change that hasn't been published on the releases page. You can run this script to create a single file version of the library so you can only include that part of it. Check `single.py --help` for more info.
59
60## Features
61
62- [Fastest in the land](http://sol2.readthedocs.io/en/latest/benchmarks.html) (see: sol bar in graph).
63- Supports retrieval and setting of multiple types including `std::string` and `std::map/unordered_map`.
64- Lambda, function, and member function bindings are supported.
65- Intermediate type for checking if a variable exists.
66- Simple API that completely abstracts away the C stack API, including `protected_function` with the ability to use an error-handling function.
67- `operator[]`-style manipulation of tables
68- C++ type representations in lua userdata as `usertype`s with guaranteed cleanup.
69- Customization points to allow your C++ objects to be pushed and retrieved from Lua as multiple consecutive objects, or anything else you desire!
70- Overloaded function calls: `my_function(1); my_function("Hello")` in the same lua script route to different function calls based on parameters
71- Support for tables, nested tables, table iteration with `table.for_each` / `begin()` and `end()` iterators.
72
73## Supported Compilers
74
75Sol makes use of C++11/14 features. GCC 4.9 and Clang 3.4 (with std=c++1z and appropriate standard library) or higher should be able to compile without problems. However, the
76officially supported and CI-tested compilers are:
77
78- GCC 4.9.0+
79- Clang 3.5+
80- Visual Studio 2015 Community (Visual C++ 14.0)+
81
82## License
83
84Sol is distributed with an MIT License. You can see LICENSE.txt for more info.
85