diff options
author | kwolekr <kwolekr@minetest.net> | 2015-01-15 18:03:43 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-01-15 18:05:13 -0500 |
commit | 5aeeb219e3fc2f37d3996a3df3b660afcc5f7599 (patch) | |
tree | a7b74445f76c6a7095e9f3d8ffea8af3727ad662 /builtin/game/misc.lua | |
parent | 9736548720a96c9c7f739edb0435d9ba4ad80652 (diff) | |
download | minetest-5aeeb219e3fc2f37d3996a3df3b660afcc5f7599.tar.gz minetest-5aeeb219e3fc2f37d3996a3df3b660afcc5f7599.tar.bz2 minetest-5aeeb219e3fc2f37d3996a3df3b660afcc5f7599.zip |
Simplify deleteblocks chat command argument parsing
Add optional core.pos_to_string decimal place rounding
Move core.string_to_pos to builtin/common/misc_helpers.lua for consistency
Diffstat (limited to 'builtin/game/misc.lua')
-rw-r--r-- | builtin/game/misc.lua | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index a392386f1..c31df541d 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -93,30 +93,6 @@ function core.get_node_group(name, group) return core.get_item_group(name, group) end -function core.string_to_pos(value) - local p = {} - p.x, p.y, p.z = string.match(value, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$") - if p.x and p.y and p.z then - p.x = tonumber(p.x) - p.y = tonumber(p.y) - p.z = tonumber(p.z) - return p - end - local p = {} - p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$") - if p.x and p.y and p.z then - p.x = tonumber(p.x) - p.y = tonumber(p.y) - p.z = tonumber(p.z) - return p - end - return nil -end - -assert(core.string_to_pos("10.0, 5, -2").x == 10) -assert(core.string_to_pos("( 10.0, 5, -2)").z == -2) -assert(core.string_to_pos("asd, 5, -2)") == nil) - function core.setting_get_pos(name) local value = core.setting_get(name) if not value then |