mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Cleanup various varargs shenanigans (#9624)
* Iterate over varargs directly via select if possible * Use table.pack otherwise (https://github.com/koreader/koreader-base/pull/1535). * This allows us to simplify a few Logger calls, as logger now handles nil values.
This commit is contained in:
@@ -1535,12 +1535,6 @@ local WrappedFunction_mt = {
|
||||
end,
|
||||
}
|
||||
|
||||
--- Helper function to help dealing with nils in varargs, since we don't have table.pack w/o Lua 5.2 compat...
|
||||
--- Unpack w/ unpack(t, 1, t.n)
|
||||
function util.table_pack(...)
|
||||
return { n = select("#", ...), ... }
|
||||
end
|
||||
|
||||
--- Wrap (or replace) a table method with a custom method, in a revertable way.
|
||||
-- This allows you extend the features of an existing module by modifying its
|
||||
-- internal methods, and then revert them back to normal later if necessary.
|
||||
|
||||
Reference in New Issue
Block a user