[ci-skip] *sob* no i cant spell gud pls come save me

This commit is contained in:
ThePhD 2016-08-11 10:27:20 -04:00
parent 135e09f31d
commit f85dba2a69
2 changed files with 3 additions and 2 deletions

View File

@ -23,4 +23,4 @@ Makes an ``R`` out of the value. The first overload deduces the type from the pa
template <typename T, typename... Args>
object make_object(lua_State* L, Args&&... args);
Makes an object out of the value. It pushes it onto the stack, then pops it into the returned ``sol::object``. The first overload deduces the type from the passed in argument, the second allows you to specify a template parameter and forward any relevant arguments to ``sol::stack::push``. The implementation essentially defers to :ref:`sol::make_reference<make-reference>` with the specified arguments, ``R == object`` and ``should_pop == true``.
Makes an object out of the value. It pushes it onto the stack, then pops it into the returned ``sol::object``. The first overload deduces the type from the passed in argument, the second allows you to specify a template parameter and forward any relevant arguments to ``sol::stack::push``. The implementation essentially defers to :ref:`sol::make_reference<make-reference>` with the specified arguments, ``R == object`` and ``should_pop == true``. It is preferred that one uses the :ref:`in_place object constructor instead<overloaded-object-constructor>`, since it's probably easier to deal with, but both versions will be supported for forever, since there's really no reason not to and people already have dependencies on ``sol::make_object``.

View File

@ -16,6 +16,7 @@ members
.. code-block:: cpp
:caption: overloaded constructor: object
:name: overloaded-object-constructor
template <typename T>
object(T&&);
@ -25,7 +26,7 @@ members
template <typename T, typename... Args>
object(lua_State* L, in_place_type_t<T>, Args&&... args);
There are 4 kinds of constructors here. One allows construction of a object from other reference types such as :doc:`sol::table<table>` and :doc:`sol::stack_reference<stack_reference>`. The secon creates an object which references the specific element at the given index in the specified ``lua_State*``. The more advanced ``in_place...`` constructors create a single object by pushing the specified type ``T`` onto the stack and then setting it as the object. It gets popped from the stack afterwards (unless this is an instance of ``sol::stack_object``, in which case it is left on the stack). An example of using this and :doc:`sol::make_object<make_reference>` can be found in the `any_return example`_
There are 4 kinds of constructors here. One allows construction of an object from other reference types such as :doc:`sol::table<table>` and :doc:`sol::stack_reference<stack_reference>`. The second creates an object which references the specific element at the given index in the specified ``lua_State*``. The more advanced ``in_place...`` constructors create a single object by pushing the specified type ``T`` onto the stack and then setting it as the object. It gets popped from the stack afterwards (unless this is an instance of ``sol::stack_object``, in which case it is left on the stack). An example of using this and :doc:`sol::make_object<make_reference>` can be found in the `any_return example`_.
.. code-block:: cpp
:caption: function: type conversion