*vim9-scopes*
When using `:function` or `:def` to specify a new function at the script level
in a Vim9 script, the function is local to the script, as if "s:" was
-prefixed. Using the "s:" prefix is optional.
-
-To define or use a global function or variable the "g:" prefix must be used.
+prefixed. Using the "s:" prefix is optional. To define or use a global
+function or variable the "g:" prefix must be used. For functions in an
+autoload script the "name#" prefix is sufficient. >
+ def ThisFunction() # script-local
+ def s:ThisFunction() # script-local
+ def g:ThatFunction() # global
+ def scriptname#function() # autoload
When using `:function` or `:def` to specify a new function inside a function,
the function is local to the function. It is not possible to define a
source sautest/autoload/sourced.vim
call assert_equal(1, g:loaded_sourced_vim)
endfunc
+
+func Test_autoload_vim9script()
+ call assert_equal('some', auto9#getsome())
+ call assert_equal(49, auto9#add42(7))
+endfunc