From f0f74e786f4c9b4d7ac2af5f383f1957466173cf Mon Sep 17 00:00:00 2001 From: devclyde Date: Thu, 23 Jun 2022 15:11:31 -0300 Subject: [PATCH] feat: add documentation for `gears.protected_call` --- lua/gears/protected_call/init.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lua/gears/protected_call/init.lua diff --git a/lua/gears/protected_call/init.lua b/lua/gears/protected_call/init.lua new file mode 100644 index 0000000..e1aadbe --- /dev/null +++ b/lua/gears/protected_call/init.lua @@ -0,0 +1,26 @@ +--- ### Description +--- Call a function in protected mode and handle error reports. +--- ### Information +--- - **Copyright**: 2016 Uli Schlachter +--- - **Originally authored by**: Uli Schlachter +--- +--- [See all contributors on GitHub](https://github.com/awesomeWM/awesome/graphs/contributors) +--- +--- [View documents](https://awesomewm.org/apidoc/utility_libraries/gears.protected_call.html) +--- @module "gears.protected_call" +local GSafety = {} + +--- ### Description +--- Call a function in protected mode and handle error-reporting. +--- If the function call succeeds, all results of the function are returned. +--- Otherwise, an error message is printed and nothing is returned. +--- ### Parameters +--- @param func function The function to call. +--- @param ... any Arguments to the function. +--- ### Returns +--- @return any result The result of the given function, or nothing if an error occurred. +--- +--- [View documents](https://awesomewm.org/apidoc/utility_libraries/gears.protected_call.html#gears.protected_call) +GSafety.protected_call = function(func, ...) end + +return GSafety