Add EnvRef:set_node()
authorPerttu Ahola <celeron55@gmail.com>
Wed, 28 Mar 2012 19:50:08 +0000 (22:50 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 28 Mar 2012 19:50:08 +0000 (22:50 +0300)
doc/lua_api.txt
src/scriptapi.cpp

index 68fbcee8c2f2f8dfdc74cb2381bf4a8dfd0cb63a..a8386406e7e3bd8a126e65cd1b7f9f0e44ca6e9b 100644 (file)
@@ -504,8 +504,9 @@ Class reference
 ----------------
 EnvRef: basically ServerEnvironment and ServerMap combined.
 methods:
-- add_node(pos, node)
-- remove_node(pos)
+- set_node(pos, node)
+- add_node(pos, node): alias set_node(pos, node)
+- remove_node(pos): equivalent to set_node(pos, "air")
 - get_node(pos)
   ^ Returns {name="ignore", ...} for unloaded area
 - get_node_or_nil(pos)
index 70ca6c86af07ff992c6898fa3651d8a8b9a0a659..38d681e9b8032545d24490eee29ec591a2053b16 100644 (file)
@@ -2791,11 +2791,11 @@ private:
        
        // Exported functions
 
-       // EnvRef:add_node(pos, node)
+       // EnvRef:set_node(pos, node)
        // pos = {x=num, y=num, z=num}
-       static int l_add_node(lua_State *L)
+       static int l_set_node(lua_State *L)
        {
-               //infostream<<"EnvRef::l_add_node()"<<std::endl;
+               //infostream<<"EnvRef::l_set_node()"<<std::endl;
                EnvRef *o = checkobject(L, 1);
                ServerEnvironment *env = o->m_env;
                if(env == NULL) return 0;
@@ -2809,6 +2809,11 @@ private:
                return 1;
        }
 
+       static int l_add_node(lua_State *L)
+       {
+               return l_set_node(L);
+       }
+
        // EnvRef:remove_node(pos)
        // pos = {x=num, y=num, z=num}
        static int l_remove_node(lua_State *L)
@@ -3118,6 +3123,7 @@ public:
 };
 const char EnvRef::className[] = "EnvRef";
 const luaL_reg EnvRef::methods[] = {
+       method(EnvRef, set_node),
        method(EnvRef, add_node),
        method(EnvRef, remove_node),
        method(EnvRef, get_node),