wrong version on luarocks.org; goto not compatible with 5.1
Closed this issue · 4 comments
sa-0001 commented
Hello, enjoying this library as it saves me a lot of time. However I would like to point out that according the luarocks page it's compatible with lua >= 5.1, whereas there are several functions which use goto, which is only compatible with 5.2.
Is there any chance you could remove the gotos, or make versions for both 5.2 and 5.1, or last but not least update luarocks? It would be very much appreciated!
mil commented
+1 for 5.1 compat
codeRebelBase commented
is there a version of this library that is lua 5.1 compatible?
tommywalkie commented
@sa-0001 @mil @codeRebelBase
Might be late but I managed to make it compatible with Lua 5.1, but I was unable to make a pull request for some reason. 🤷♂️
In case someone need to know what to do, here are the updated functions :
- dropWhile() (used in _.dropRightWhile and _.dropWhile)
local dropWhile = function(array, predicate, selfArg, start, step, right)
local t = {}
local c = start
while not _.isNil(array[c]) do
while #t == 0 and callIteratee(predicate, selfArg, array[c], c, array) do
c = c + step
end
if right then
_.enqueue(t, array[c])
else
_.push(t, array[c])
end
c = c + step
end
return t
end
- _.pull
_.pull = function(array, ...)
local i = 1
local st = false
while not _.isNil(array[i]) do
st = false
for k, v in ipairs(_.table(...)) do
if array[i] == v then
table.remove(array, i)
st = true
end
end
if (st == false) then
i = i + 1
end
end
return array
end
- _.remove
_.remove = function(array, predicate)
local t = {}
local c = 1
local predicate = predicate or _.identity
local st = false
while not _.isNil(array[c]) do
st = false
if predicate(array[c], c, array) then
_.push(t, table.remove(array, c))
st = true
end
if (st == false) then
c = c + 1
end
end
return t
end