From d213e5aa166bcfd9b39802ac564938f5f7610b4b Mon Sep 17 00:00:00 2001 From: Diego Martinez Date: Sun, 21 Dec 2014 15:01:08 -0300 Subject: [PATCH] Localize globals. --- signs_lib/init.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/signs_lib/init.lua b/signs_lib/init.lua index 5cec8da7..5622571f 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -179,9 +179,7 @@ local CHARDB_FILE = minetest.get_worldpath().."/signs_lib_chardb" -- helper functions to trim sign text input/output local function trim_input(text) - local txt_len = string.len(text) - text_trimmed = string.sub(text, 1, math.min(MAX_INPUT_CHARS, txt_len)) - return text_trimmed + return text:sub(1, math.min(MAX_INPUT_CHARS, text:len())) end -- Returns true if any file differs from cached one. @@ -630,8 +628,7 @@ function signs_lib.receive_fields(pos, formname, fields, sender, lock) sender:get_player_name()) return end - lockstr = "" - if lock then lockstr = "locked " end + local lockstr = lock and "locked " or "" if fields and fields.text and fields.ok then minetest.log("action", S("%s wrote \"%s\" to "..lockstr.."sign at %s"):format( (sender:get_player_name() or ""),