BugFix: Fix function component not working (#175)
When the provided function takes an optional argument the previous implementation causes error.
This commit is contained in:
parent
4f53d053a1
commit
aa844a9555
|
@ -1,9 +1,8 @@
|
|||
local FunctionComponent = require('lualine.component'):new()
|
||||
|
||||
FunctionComponent.new = function(self, options, child)
|
||||
local new_instence = self._parent:new(options, child or FunctionComponent)
|
||||
new_instence.update_status = options[1]
|
||||
return new_instence
|
||||
FunctionComponent.update_status = function(self)
|
||||
-- 1st element in options table is the function provided by config
|
||||
return self.options[1]()
|
||||
end
|
||||
|
||||
return FunctionComponent
|
||||
|
|
Loading…
Reference in New Issue