Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zenroom
Zenroom
Commits
2f4a82ef
Commit
2f4a82ef
authored
Jan 24, 2019
by
Jaromil
Browse files
small check on F.map() input table
parent
124415f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lua/functional.lua
View file @
2f4a82ef
...
...
@@ -231,6 +231,11 @@ end
-- @param[opt] ... Optional args to be passed to `f`
-- @return a table of results
function
_
.
map
(
t
,
f
,
...
)
-- safety
if
not
(
type
(
t
)
==
"table"
)
then
return
{}
end
if
t
==
nil
then
return
{}
end
-- if #t == 0 then return {} end
local
_t
=
{}
for
index
,
value
in
_
.
pairs
(
t
)
do
local
k
,
kv
,
v
=
index
,
f
(
index
,
value
,
...
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment