From 38944467d31bbfa8a98008962f147cbc3c73f507 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 12 Nov 2011 13:59:56 +0200 Subject: Scripting WIP --- src/scriptapi.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/scriptapi.cpp') diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index dc9c832d2..428810117 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -367,7 +367,8 @@ private: } // Exported functions - + + // remove(self) static int l_remove(lua_State *L) { ObjectRef *ref = checkobject(L, 1); @@ -377,7 +378,9 @@ private: co->m_removed = true; return 0; } - + + // getpos(self) + // returns: {x=num, y=num, z=num} static int l_getpos(lua_State *L) { ObjectRef *ref = checkobject(L, 1); @@ -393,7 +396,8 @@ private: lua_setfield(L, -2, "z"); return 1; } - + + // setpos(self, pos) static int l_setpos(lua_State *L) { ObjectRef *ref = checkobject(L, 1); @@ -406,7 +410,8 @@ private: co->setPos(pos); return 0; } - + + // moveto(self, pos, continuous=false) static int l_moveto(lua_State *L) { ObjectRef *ref = checkobject(L, 1); @@ -415,8 +420,10 @@ private: if(co == NULL) return 0; // pos v3f pos = readFloatPos(L, 2); + // continuous + bool continuous = lua_toboolean(L, 3); // Do it - co->moveTo(pos); + co->moveTo(pos, continuous); return 0; } -- cgit v1.2.3