User Tools

Site Tools


dev:core:funref:decode_pos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:core:funref:decode_pos [2019-10-02 19:44]
82.67.173.193 created
dev:core:funref:decode_pos [2020-01-22 10:53] (current)
admin ↷ Links adapted because of a move operation
Line 11: Line 11:
 ===== Extended description ===== ===== Extended description =====
 This function creates a string from the given Minetest position vector, suitable for use as a table index.   This function creates a string from the given Minetest position vector, suitable for use as a table index.  
-See also ''[[reference:advtrains:encode_pos|advtrains.encode_pos]]''.+See also ''[[dev:core:funref:encode_pos|advtrains.encode_pos]]''.
  
 ===== Parameters ===== ===== Parameters =====
-  * ''pts'' //(string)//: a table index string created by ''[[reference:advtrains:encode_pos|advtrains.encode_pos]]''.+  * ''pts'' //(string)//: a table index string created by ''[[dev:core:funref:encode_pos|advtrains.encode_pos]]''.
  
 ===== Returns ===== ===== Returns =====
Line 33: Line 33:
  
 ===== How it works internally ===== ===== How it works internally =====
-This function converts back strings created by ''[[reference:advtrains:encode_pos|advtrains.encode_pos]]'' to their original vector form. Y, X and Z coordinates are treated separately: the corresponding parts of the argument are extracted and passed to ''dec'', which converts the hexadecimal form of a number to its decimal form.+This function converts back strings created by ''[[dev:core:funref:encode_pos|advtrains.encode_pos]]'' to their original vector form. Y, X and Z coordinates are treated separately: the corresponding parts of the argument are extracted and passed to ''dec'', which converts the hexadecimal form of a number to its decimal form.
   - Y coordinate is encoded in characters 1 to 4.   - Y coordinate is encoded in characters 1 to 4.
   - X coordinate is encoded in characters 5 to 8.   - X coordinate is encoded in characters 5 to 8.
Line 48: Line 48:
 advtrains/helpers.lua, lines 383 to 389: advtrains/helpers.lua, lines 383 to 389:
  
-<file lua encode_pos.lua>+<file lua decode_pos.lua>
 -- DEPENDENCY CODE -- DEPENDENCY CODE
 local hext = { [0]="0",[1]="1",[2]="2",[3]="3",[4]="4",[5]="5",[6]="6",[7]="7",[8]="8",[9]="9",[10]="A",[11]="B",[12]="C",[13]="D",[14]="E",[15]="F"} local hext = { [0]="0",[1]="1",[2]="2",[3]="3",[4]="4",[5]="5",[6]="6",[7]="7",[8]="8",[9]="9",[10]="A",[11]="B",[12]="C",[13]="D",[14]="E",[15]="F"}
dev/core/funref/decode_pos.1570038278.txt.gz · Last modified: 2019-10-02 19:44 by 82.67.173.193