Difference between revisions of "User talk:Afflatus"

From Minetest Developer Wiki
Jump to navigation Jump to search
Line 23: Line 23:
 
  +* `vector.angle_between(v1, v2)` : returns the angle between two 2d vectors (x,z) in radians
 
  +* `vector.angle_between(v1, v2)` : returns the angle between two 2d vectors (x,z) in radians
 
  +* `vector.yaw(v)` : returns yaw from a 2d vector (x, z) in radians
 
  +* `vector.yaw(v)` : returns yaw from a 2d vector (x, z) in radians
 +
 +
---
 +
 +
+* `string:toarray()`
 +
+    * returns an array, every character is one element
 +
+    * e.g. `("foo"):toarray()[3] == "o"`
 +
+    * should work faster than gmatch
 +
 +
+* string indexing
 +
+    * if the index is an integer, the character at index or nil is returned
 +
+    * e.g. `("foo")[1] == "f"`
  
 
---
 
---

Revision as of 05:21, 11 July 2016

find_nodes_in_area_under_air

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2070

---

"should return the leftover itemstack (if nil, no item is removed) " http://dev.minetest.net/minetest.register_craftitem#Callbacks https://github.com/minetest/minetest_game/pull/1173 https://github.com/minetest/minetest/blob/fa0bbbf96df17f0d7911274ea85e5c049c20d07b/doc/lua_api.txt#L3466 https://github.com/minetest/minetest/blob/fa0bbbf96df17f0d7911274ea85e5c049c20d07b/doc/lua_api.txt#L3625

---

+* `vector.random2d()` : returns a new normalized 2d vector with random values
+* `vector.random3d()` : returns a new normalized 3d vector with random values
+* `vector.set_length(v, l)` : returns a vector with a specific length (magnitude)
+* `vector.limit(v, l)` : limits the length of a vector
+* `vector.dot(v1, v2)` : returns the dot product of two vectors
+* `vector.cross(v1, v2)` : returns the cross product of two vectors
+* `vector.scalar_triple(v1, v2, v3)` : returns the scalar triple product of three vectors
+* `vector.vector_triple(v1, v2, v3)` : returns the vector triple product of three vectors
+* `vector.angle_between(v1, v2)` : returns the angle between two 2d vectors (x,z) in radians
+* `vector.yaw(v)` : returns yaw from a 2d vector (x, z) in radians

---

+* `string:toarray()`
+    * returns an array, every character is one element
+    * e.g. `("foo"):toarray()[3] == "o"`
+    * should work faster than gmatch
+* string indexing
+    * if the index is an integer, the character at index or nil is returned
+    * e.g. `("foo")[1] == "f"`

---