summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Guerrero <jeanpatrick.guerrero@gmail.com>2016-12-13 17:12:22 +0100
committerJP Guerrero <jeanpatrick.guerrero@gmail.com>2016-12-13 17:12:22 +0100
commit99f2fc1b50c9f3ee7063b2648afd8173a2813c61 (patch)
tree01313fb2ddf85d2f7ca8f51f06957d95649599a9
parentf141fbf806e5440fb94052d3b561e7217fcb0427 (diff)
Tune Lua pattern
-rw-r--r--init.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index fd3cd44..e451f31 100644
--- a/init.lua
+++ b/init.lua
@@ -1,11 +1,9 @@
local craftguide, datas = {}, {}
-local min, max, ceil, floor = math.min, math.max, math.ceil, math.floor
-local function round(n) return floor((floor(n * 2) + 1) / 2) end
-
local progressive_mode = minetest.setting_getbool("craftguide_progressive_mode")
+local min, max, ceil, floor = math.min, math.max, math.ceil, math.floor
local iX, iY = (minetest.setting_get("craftguide_size") or "8x3"):match(
- "([%d]+[.%d+]*)[%s+]*x[%s+]*([%d]+[.%d+]*)")
-iX, iY = max(8, round(iX or 8)), max(1, round(iY or 3))
+ "([%d]+)[.%d+]*[^%d]*x[^%d]*([%d]+)[.%d+]*")
+iX, iY = max(8, iX or 8), max(1, iY or 3)
local ipp = iX * iY
local offset_X = (iX / 2) + (iX % 2 == 0 and 0.5 or 0)