copy.rst 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. copy
  2. ----------------
  3. Motivation
  4. ~~~~~~~~~~
  5. This will make a copy of the parameter. This is the default behavior when
  6. passing parameters by-value. Note that this can only be used when passing from
  7. C++ to Lua. This policy requires that the parameter type has an accessible copy
  8. constructor.
  9. Defined in
  10. ~~~~~~~~~~
  11. .. parsed-literal::
  12. #include <luabind/copy_policy.hpp>
  13. Synopsis
  14. ~~~~~~~~
  15. .. parsed-literal::
  16. copy(index)
  17. Parameters
  18. ~~~~~~~~~~
  19. ============= ===============================================================
  20. Parameter Purpose
  21. ============= ===============================================================
  22. ``index`` The index to copy. ``result`` when used while wrapping C++
  23. functions. ``_N`` when passing arguments to Lua.
  24. ============= ===============================================================
  25. Example
  26. ~~~~~~~
  27. .. parsed-literal::
  28. X* get()
  29. {
  30. static X instance;
  31. return &instance;
  32. }
  33. ...
  34. module(L)
  35. [
  36. def("create", &create, **copy(result)**)
  37. ];