What is the difference between the following two ways of calling a function/method in vimscript?
" This seems to always work
call add (events, e)
" This seems to occasionally work
events->add(e)
For example, with the latter command, it works when running in the command-line, but when running in a function it returns:
E492: Not an editor command: events->add(e)
It seems pretty inconsistent too, because literally the line above it I am doing:
if (all_valid_events->index(e) != -1) <-- this works
events->add(e) <-- this fails
Additionally, is there a 'name' for the two different type of function calls? Is one preferred over the other (or why are there two different ways, one of which only works about half of the time?)