Closed ryanc-me closed 10 years ago
The conditional syntax:
local lume = lume or require "lume"
boils down to this logic:
if lume == nil then
lume = require "lume"
end
So that if you've used lume elsewhere in the project, you just use that instance, instead of a new one.
Perhaps I should have clarified: I wasn't struggling with the syntax, but rather the intent.
I'm still not seeing the purpose. This seems to be disregarding the caching-functionality of require all together, for example, the following:
a = require "lume"
b = require "lume"
print(a == b)
will print true
, as the table returned by require is identical each time (assuming its entry in the package.loaded table has not been altered manually)
I'm a bit confused as to the purpose of this change. Would you be able the explain what the change achieves? Thanks.