From dc2493e7525bb7633f697ef10f72b72b46222249 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Fri, 30 Aug 2019 00:45:36 -0400 Subject: Forget what I said, I just need to change git attributes to mark for vendor --- lib/sol2/docs/source/api/metatable_key.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/sol2/docs/source/api/metatable_key.rst (limited to 'lib/sol2/docs/source/api/metatable_key.rst') diff --git a/lib/sol2/docs/source/api/metatable_key.rst b/lib/sol2/docs/source/api/metatable_key.rst new file mode 100644 index 0000000..7eeff47 --- /dev/null +++ b/lib/sol2/docs/source/api/metatable_key.rst @@ -0,0 +1,16 @@ +metatable_key +============= +*a key for setting and getting an object's metatable* + + +.. code-block:: cpp + + struct metatable_key_t {}; + const metatable_key_t metatable_key; + +You can use this in conjunction with :doc:`sol::table` to set/get a metatable. Lua metatables are powerful ways to override default behavior of objects for various kinds of operators, among other things. Here is an entirely complete example, showing getting and working with a :doc:`usertype`'s metatable defined by sol: + +.. literalinclude:: ../../../examples/source/metatable_key_low_level.cpp + :caption: messing with metatables + :name: sol-metatable_key-eg + :linenos: -- cgit v1.2.3