diff --git a/README.md b/README.md index c02f2770..8dfc40d3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Sol 2.11 +## Sol 2.12 [![Build Status](https://travis-ci.org/ThePhD/sol2.svg?branch=develop)](https://travis-ci.org/ThePhD/sol2) [![Documentation Status](https://readthedocs.org/projects/sol2/badge/?version=latest)](http://sol2.readthedocs.io/en/latest/?badge=latest) diff --git a/docs/source/api/api-top.rst b/docs/source/api/api-top.rst index 861d05d4..631a2633 100644 --- a/docs/source/api/api-top.rst +++ b/docs/source/api/api-top.rst @@ -31,6 +31,7 @@ Browse the various function and classes :doc:`Sol<../index>` utilizes to make yo optional state table + as_table metatable_key this_state thread diff --git a/docs/source/api/as_function.rst b/docs/source/api/as_function.rst index efe59b07..bd1f9ec8 100644 --- a/docs/source/api/as_function.rst +++ b/docs/source/api/as_function.rst @@ -1,7 +1,7 @@ as_function =========== -make sure a parameter is pushed as a function ---------------------------------------------- +make sure an object is pushed as a function +------------------------------------------- .. code-block:: cpp diff --git a/docs/source/api/as_table.rst b/docs/source/api/as_table.rst new file mode 100644 index 00000000..58870fa7 --- /dev/null +++ b/docs/source/api/as_table.rst @@ -0,0 +1,24 @@ +as_table +=========== +make sure an object is pushed as a table +---------------------------------------- + +.. code-block:: cpp + + template + as_table_t { ... }; + + template + as_table_t as_function ( T&& container ); + +This function serves the purpose of ensuring that an object is pushed -- if possible -- like a table into Lua. The container passed here can be a pointer, a reference, a ``std::reference_wrapper`` around a container, or just a plain container value. It must have a begin/end function, and if it has a ``std::pair`` as its ``value_type``, it will be pushed as a dictionary. Otherwise, it's pushed as a sequence. + +.. code-block:: cpp + + sol::state lua; + lua.open_libraries(); + lua.set("my_table", sol::as_table(std::vector{ 1, 2, 3, 4, 5 })); + lua.script("for k, v in ipairs(my_table) do print(k, v) assert(k == v) end"); + + +Note that any caveats with Lua tables apply the moment it is serialized, and the data cannot be gotten out back out in C++ as a vector without explicitly using the ``as_table_t`` marker for your get and conversion operations using Sol. \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 9e08bbc9..098d3639 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -59,9 +59,9 @@ author = 'ThePhD' # built documents. # # The short X.Y version. -version = '2.11' +version = '2.12' # The full version, including alpha/beta/rc tags. -release = '2.11.7' +release = '2.12.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 237ecdf3..ca56fd32 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2016-08-24 12:40:13.351588 UTC -// This header was generated with sol v2.11.7 (revision 54cffb7) +// Generated 2016-08-24 13:16:37.429596 UTC +// This header was generated with sol 2.12.0 (revision 1e62e3c) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP