Diff

plugins/mod_console.lua @ 3027:b5beb7b15ac4

mod_console: Set a chunk name for loadstring calls (nicer errors).
author Waqas Hussain <waqas20@gmail.com>
date Fri, 07 May 2010 16:10:04 +0500
parent 2923:b7049746bd29
child 3028:e095d2a98936
child 3043:1fadbb2e3ca0
line wrap: on
line diff
--- a/plugins/mod_console.lua	Fri May 07 16:04:45 2010 +0500
+++ b/plugins/mod_console.lua	Fri May 07 16:10:04 2010 +0500
@@ -84,9 +84,10 @@
 
 			session.env._ = data;
 			
-			local chunk, err = loadstring("return "..data);
+			local chunkname = "=console";
+			local chunk, err = loadstring("return "..data, chunkname);
 			if not chunk then
-				chunk, err = loadstring(data);
+				chunk, err = loadstring(data, chunkname);
 				if not chunk then
 					err = err:gsub("^%[string .-%]:%d+: ", "");
 					err = err:gsub("^:%d+: ", "");