Hi,
Ni Va schrieb am 15.01.2021 um 14:38:
>
> I got this kind of classical logfile :
>
> 2021/01/14 07:42:22.588 InformationFoo dbg
> 2021/01/14 07:42:22.588 InformationBar dbg
> 2021/01/14 07:42:22.588 Information Foobar dbg
> 2021/01/14 07:42:22.588 Information Barbar dbg
> ..
> .
>
> and would like to add all lines' informations split by space into dict or array in vim9script.
> ['2021/01/14', '07:42:22.588', 'Information Foo dbg ']
>
> trying map(getline(1, '$'), ' v:val->split() ') it returns list<list<string>> but impossible to declare var foo: list<list<string>>
>
> How can I fix it ?
you need to use mapnew() instead of map(), because the item type changes.
getline() returns a list of strings. The supplied expression would replace
every item of type string by an item of type list<string>. In Vim9 script
this is not allowed. Instead you need to use mapnew() which creates a new
list which is then filled with the results of the mapping expression.
Regards,
Jürgen