From 650bde830c19f8fefb37a55503db46dcef7d510d Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Sat, 16 Jun 2012 14:22:35 +0200 Subject: [PATCH] Portable way to use loadstring Signed-off-by: Arvydas Sidorenko Signed-off-by: Uli Schlachter --- lib/awful/remote.lua.in | 4 ++-- lib/awful/util.lua.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/awful/remote.lua.in b/lib/awful/remote.lua.in index d3d7b5e4..c4e1b8ed 100644 --- a/lib/awful/remote.lua.in +++ b/lib/awful/remote.lua.in @@ -6,7 +6,7 @@ -- Grab environment we need require("awful.dbus") -local loadstring = loadstring +local load = loadstring or load -- v5.1 - loadstring, v5.2 - load local tostring = tostring local ipairs = ipairs local table = table @@ -20,7 +20,7 @@ local type = type if dbus then dbus.connect_signal("org.naquadah.awesome.awful.Remote", function(data, code) if data.member == "Eval" then - local f, e = loadstring(code) + local f, e = load(code) if f then results = { f() } retvals = {} diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in index b225ec78..74ac127c 100644 --- a/lib/awful/util.lua.in +++ b/lib/awful/util.lua.in @@ -8,7 +8,7 @@ local os = os local io = io local assert = assert -local loadstring = loadstring +local load = loadstring or load -- v5.1 - loadstring, v5.2 - load local loadfile = loadfile local debug = debug local pairs = pairs @@ -108,7 +108,7 @@ end --- Eval Lua code. -- @return The return value of Lua code. function util.eval(s) - return assert(loadstring(s))() + return assert(load(s))() end local xml_entity_names = { ["'"] = "'", ["\""] = """, ["<"] = "<", [">"] = ">", ["&"] = "&" };