|
|
@@ -214,16 +214,18 @@ generates a <code>std::pair<Pushable, Pushable></code> expression.</p>
|
|
|
|
|
|
// Methods need to be declared here
|
|
|
{
|
|
|
- {"scale", LUWRA_WRAP(Point::scale)},
|
|
|
- {"x", LUWRA_WRAP(Point::x)},
|
|
|
- {"y", LUWRA_WRAP(Point::y)},
|
|
|
- {"magicNumber", 1337},
|
|
|
- {"magicString", "Hello World"}
|
|
|
+ {"scale", LUWRA_WRAP(Point::scale)},
|
|
|
+ {"x", LUWRA_WRAP(Point::x)},
|
|
|
+ {"y", LUWRA_WRAP(Point::y)},
|
|
|
+ {"magic", luwra::FieldVector {
|
|
|
+ {"number", 1337},
|
|
|
+ {"string", "Hello World"}
|
|
|
+ }}
|
|
|
},
|
|
|
|
|
|
// Meta methods may be registered aswell
|
|
|
{
|
|
|
- LUWRA_MEMBER(Point, __tostring)
|
|
|
+ {"__tostring", LUWRA_WRAP(Point::__tostring)}
|
|
|
}
|
|
|
);
|
|
|
</code></pre>
|
|
|
@@ -236,15 +238,18 @@ and name from the call to <code>registerUserType</code>.</p>
|
|
|
|
|
|
// Methods need to be declared here
|
|
|
{
|
|
|
- LUWRA_MEMBER(Point, scale),
|
|
|
- LUWRA_MEMBER(Point, x),
|
|
|
- LUWRA_MEMBER(Point, y),
|
|
|
- {"magicNumber", 1337}
|
|
|
+ {"scale", LUWRA_WRAP(Point::scale)},
|
|
|
+ {"x", LUWRA_WRAP(Point::x)},
|
|
|
+ {"y", LUWRA_WRAP(Point::y)},
|
|
|
+ {"magic", luwra::FieldVector {
|
|
|
+ {"number", 1337},
|
|
|
+ {"string", "Hello World"}
|
|
|
+ }}
|
|
|
},
|
|
|
|
|
|
// Meta methods may be registered aswell
|
|
|
{
|
|
|
- LUWRA_MEMBER(Point, __tostring)
|
|
|
+ {"__tostring", LUWRA_WRAP(Point::__tostring)}
|
|
|
}
|
|
|
);
|
|
|
</code></pre>
|
|
|
@@ -270,7 +275,7 @@ print(point)
|
|
|
print(point:x(), point:y())
|
|
|
|
|
|
-- Set property 'x'
|
|
|
-point:x(point.magicNumber)
|
|
|
+point:x(point.magic.number)
|
|
|
</code></pre>
|
|
|
|
|
|
<h2 id="manually-constructing-a-user-type">Manually constructing a user type</h2>
|