patch 8.1.1019: Lua: may garbage collect function reference in use
Problem: Lua: may garbage collect function reference in use.
Solution: Keep the function name instead of the typeval. Make luaV_setref()
handle funcref objects. (Ozaki Kiichi, closes #4127)
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim
index 7fcdad5..ec28183 100644
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -449,6 +449,7 @@
lua d.len = vim.funcref"Mylen" -- assign d as 'self'
lua res = (d.len() == vim.funcref"len"(vim.eval"l")) and "OK" or "FAIL"
call assert_equal("OK", luaeval('res'))
+ call assert_equal(function('Mylen', {'data': l, 'len': function('Mylen')}), mydict.len)
lua i1, i2, msg, d, res = nil
endfunc