pure_out_value.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. pure_out_value
  2. ----------------
  3. Motivation
  4. ~~~~~~~~~~
  5. This works exactly like ``out_value``, except that it will pass a
  6. default constructed object instead of converting an argument from
  7. Lua. This means that the parameter will be removed from the lua
  8. signature.
  9. Defined in
  10. ~~~~~~~~~~
  11. .. parsed-literal::
  12. #include <luabind/out_value_policy.hpp>
  13. Synopsis
  14. ~~~~~~~~
  15. .. parsed-literal::
  16. pure_out_value(index, policies = none)
  17. Parameters
  18. ~~~~~~~~~~
  19. =============== =============================================================
  20. Parameter Purpose
  21. =============== =============================================================
  22. ``index`` The index of the parameter to be used as an out parameter.
  23. ``policies`` The policies used internally to convert the out parameter
  24. to Lua. ``_1`` is used as the internal index.
  25. =============== =============================================================
  26. Example
  27. ~~~~~~~
  28. Note that no values are passed to the calls to ``f1`` and ``f2``.
  29. .. parsed-literal::
  30. void f1(float& val) { val = 10.f; }
  31. void f2(float\* val) { \*val = 10.f; }
  32. module(L)
  33. [
  34. def("f", &f, **pure_out_value(_1)**)
  35. ];
  36. Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio
  37. > print(f1())
  38. 10
  39. > print(f2())
  40. 10