You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR
Variable 'command_exist' does not exist
at test.ab:10:2
9 |
10| command_exist(split("foo bar", " ")[0])
11|
and if i store function result in variable :
let splitText = split("foo bar", " ")[0]
command_exist(splitText)
ERROR
1st argument 'command' of function 'command_exist' expects type 'Text', but '[Text]' was given
at test.ab:10:2
9 | let splitText = split("foo bar", " ")[0]
10| command_exist(splitText)
thx
The text was updated successfully, but these errors were encountered:
I think that the [0] doesn't work on expressions as of right now. You'd have to assign it to a variable first. This is something that has to be improved soon. Thanks for the issue! I'll add a warning in the docs so that people can see this
for a more comprehensive code, i created a function and it works great.
fun array_value(array, index) {
return array[index]
}
main {
let splitText = array_value(split("foo bar", " "), 0)
command_exist(splitText)
command_exist(array_value(split("foobar", " "), 0))
}
Ph0enixKM
changed the title
Error when function used as array directly
✨ Subscript syntax should work for any expression that is of type array
Jun 18, 2024
Ph0enixKM
changed the title
✨ Subscript syntax should work for any expression that is of type array
[Feature] Subscript syntax should work for any expression that is of type array
Sep 16, 2024
Hi,
we have many project of bash script, and i think amber is very cool
when i use the function directly as array, i have a parser error :
But i seem is incorrect.
Parser :
and if i store function result in variable :
thx
The text was updated successfully, but these errors were encountered: