summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <quaker66@gmail.com>2014-02-10 14:52:47 +0000
committerDaniel Kolesa <quaker66@gmail.com>2014-02-10 14:52:47 +0000
commit5d7e2b4b1c03e71e9ec04f39b48b4f0b035c38e9 (patch)
tree49768dc22012de5f63e750fe734c71ab4f2635ff
parent27df6ad026f24d311e9f31bae225776aa314c351 (diff)
pcall that stuff
-rw-r--r--util.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/util.lua b/util.lua
index 2395598..4769e42 100644
--- a/util.lua
+++ b/util.lua
@@ -1210,12 +1210,14 @@ M.help = help
1210local ffi_new = ffi.new 1210local ffi_new = ffi.new
1211local ffi_load = ffi.load 1211local ffi_load = ffi.load
1212local C = ffi.C 1212local C = ffi.C
1213local pcall = pcall
1213 1214
1214local loaded_libs = {} 1215local loaded_libs = {}
1215M.load_lib = function(name) 1216M.load_lib = function(name)
1216 local v = loaded_libs[name] 1217 local v = loaded_libs[name]
1217 if v then return v end 1218 if v then return v end
1218 v = ffi_load(name) 1219 local status, v = pcall(ffi_load, name)
1220 if not status then return status, v end
1219 loaded_libs[name] = v 1221 loaded_libs[name] = v
1220 return v 1222 return v
1221end 1223end