vim9script def Foo(bar: dict<string>) if exists('bar["a"]') echo "it exists" else echo "it doesn't exist" endif enddef Foo({'a': '...'}) Foo({'b': '...'}) This should echo: it exists it doesn’t exist But it echoes: it doesn’t exist it doesn’t exist I have tried all kinds of combinations, including checking for l:bar[“a”] and a:bar[“a”]. The only thing that works is to assign the bar argument to a global variable and testing that instead, but that’s a kluge. Regards, Christian -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/09A2938C-037E-4ACE-9C14-FB2C9F594241%40hxcore.ol. |
- vim9 exists() can't test whether a dictionary value ... Christian J. Robinson
- Re: vim9 exists() can't test whether a dictiona... Bram Moolenaar
