Permalink
Browse files

Improve Coordinate in Lua

  • Loading branch information...
feragon committed Jun 8, 2016
1 parent b10e279 commit f596a43b8390a4286180caf9e4121195f0fc3c6f
Showing with 16 additions and 6 deletions.
  1. +16 −6 lcadluascript/cad/lualibrecadbridge.cpp
@@ -103,12 +103,22 @@ void lua_openlckernel(lua_State* L) {
.addFunction("z", &geo::Coordinate::z)
.endClass()
.beginClass<geo::Coordinate>("Coordinate")
.addConstructor(LUA_ARGS(
double x,
double y))
.addFunction("x", &geo::Coordinate::x)
.addFunction("y", &geo::Coordinate::y)
.addFunction("z", &geo::Coordinate::z)
.addConstructor(LUA_ARGS(
_opt<double> x,
_opt<double> y,
_opt<double> z))
.addFunction("x", &geo::Coordinate::x)
.addFunction("y", &geo::Coordinate::y)
.addFunction("z", &geo::Coordinate::z)
.addFunction("add", [](const geo::Coordinate* c1, const geo::Coordinate c2) {
return *c1 + c2;
})
.addFunction("sub", [](const geo::Coordinate* c1, const geo::Coordinate c2) {
return *c1 - c2;
})
.endClass()
.beginClass<geo::Vector>("Vector")
.addConstructor(LUA_SP(std::shared_ptr<const geo::Vector>), LUA_ARGS(

0 comments on commit f596a43

Please sign in to comment.