# HG changeset patch # User jbe # Date 1334672792 -7200 # Node ID ebdc20b7048b7267464fce7afefcdafb7af9d938 # Parent 937bbe05098c2946b736472591aafb9a0a4ca5ae Lua 5.2 compatibility: Make function load accepting strings as first argument diff -r 937bbe05098c -r ebdc20b7048b framework/cgi-bin/webmcp.lua --- a/framework/cgi-bin/webmcp.lua Tue Apr 17 15:39:27 2012 +0200 +++ b/framework/cgi-bin/webmcp.lua Tue Apr 17 16:26:32 2012 +0200 @@ -6,6 +6,23 @@ if not table.unpack then table.unpack = unpack end +do + local old_load = load + function load(ld, ...) + if type(ld) == string then + local done = false + local func = function() + if not done then + done = true + return ld + end + end + return old_load(func, ...) + else + return old_load(ld, ...) + end + end +end -- include "../lib/" in search path for libraries if not WEBMCP_PATH then @@ -144,7 +161,7 @@ if file then local filedata = file:read("*a") io.close(file) - local func, errmsg = loadstring(filedata, "=" .. filename) + local func, errmsg = load(filedata, "=" .. filename) if func then func() return true