mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
16 lines
306 B
Lua
16 lines
306 B
Lua
function SafeInvoke(func)
|
|
-- safely invoke a functions
|
|
-- if the function returns an error, return an empty string
|
|
-- otherwise return the result of the function
|
|
|
|
local ok, result = pcall(func)
|
|
|
|
if ok then
|
|
return result
|
|
else
|
|
return ""
|
|
end
|
|
end
|
|
|
|
return SafeInvoke
|