To: vim_dev@googlegroups.com Subject: Patch 8.2.2578 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2578 Problem: Lua cannot handle a passed in lambda. Solution: Handle VAR_PARTIAL. (Prabir Shrestha, closes #7937, closes #7936) Files: src/if_lua.c, src/testdir/test_lua.vim *** ../vim-8.2.2577/src/if_lua.c 2020-10-26 20:18:04.980177381 +0100 --- src/if_lua.c 2021-03-08 19:46:27.212397179 +0100 *************** *** 568,573 **** --- 568,578 ---- case VAR_FUNC: luaV_pushfuncref(L, tv->vval.v_string); break; + case VAR_PARTIAL: + // TODO: handle partial arguments + luaV_pushfuncref(L, partial_name(tv->vval.v_partial)); + break; + case VAR_BLOB: luaV_pushblob(L, tv->vval.v_blob); break; *** ../vim-8.2.2577/src/testdir/test_lua.vim 2020-10-26 20:18:04.980177381 +0100 --- src/testdir/test_lua.vim 2021-03-08 19:49:24.356279248 +0100 *************** *** 121,126 **** --- 121,135 ---- lua v = nil endfunc + " Test luaeval() with lambda + func Test_luaeval_with_lambda() + lua function hello_luaeval_lambda(a, cb) return a .. cb() end + call assert_equal('helloworld', + \ luaeval('hello_luaeval_lambda(_A[1], _A[2])', + \ ['hello', {->'world'}])) + lua hello_luaeval_lambda = nil + endfunc + " Test vim.window() func Test_lua_window() e Xfoo2 *** ../vim-8.2.2577/src/version.c 2021-03-08 19:04:01.838606871 +0100 --- src/version.c 2021-03-08 19:47:33.320363793 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2578, /**/ -- "I've been teaching myself to play the piano for about 5 years and now write most of my songs on it, mainly because I can never find any paper." Jeff Lynne, ELO's greatest hits /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///