diff mod_register_web/mod_register_web.lua @ 1231:502ce9672eae

mod_register_web: Use local
author Kim Alvefur <zash@zash.se>
date Sat, 30 Nov 2013 20:29:21 +0100
parents f7c561fbd5a6
children 12f59489ef6e
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Sat Nov 30 20:28:07 2013 +0100
+++ b/mod_register_web/mod_register_web.lua	Sat Nov 30 20:29:21 2013 +0100
@@ -55,15 +55,16 @@
 	end
 else
 	module:log("debug", "No Recaptcha options set, using fallback captcha")
+	local random = math.random;
 	local hmac_sha1 = require "util.hashes".hmac_sha1;
 	local secret = require "util.uuid".generate()
 	local ops = { '+', '-' };
 	local captcha_tpl = get_template "simplecaptcha";
 	function generate_captcha()
-		local op = ops[math.random(1, #ops)];
-		local x, y = math.random(1, 9)
+		local op = ops[random(1, #ops)];
+		local x, y = random(1, 9)
 		repeat
-			y = math.random(1, 9);
+			y = random(1, 9);
 		until x ~= y;
 		local answer;
 		if op == '+' then