Hi Bram
Thank you for answer. 

Considering this minimal reproducing test which succeed as your,
 it doesn't come from api vim-lua, but from my own middleware vim9 script, 
I will have to look furthermore the params'values i pass. 

Ps: Forget the code and space errors, it was just the idea. 
compute.utils was just to say i use and require a lua helper script of my 
own. 
Vim9 client code --  vim9 export def func -- lua helper script 
minimal-test-vim9-lua- 
<https://drive.google.com/file/d/1OpYlh8ZfYLraFW492h88Yteqb1jKAfpf/view?usp=drivesdk>

Thank you for your help, I will see that. 
Nikola
Le mardi 6 juin 2023 à 18:57:09 UTC+2, Bram Moolenaar a écrit :

>
> > I use luaeval to compute some float result.
> > these floating values are returned 
> > to vim9 defined func which itself returns float type. 
> > 
> > When i run a try, vim echoes error E1012: type mismatch; expected float 
> but 
> > got number. 
> > 
> > 
> > Code:
> > def Foo(): float
> > return luaeval('require("compute.utils" ).luamethod(_A.x,_A.y)', {'x' : 
> > '2.0', 'y' : '1.0' }) 
> > enddef
> > 
> > When i print returned value of lua méthode, it prints 1.0
>
> I get an error for loading compute.utils:
> [string "luaeval"]:1: module 'compute.utils' not found:
> <09>no field package.preload['compute.utils']
>
> Does that need to be installed first?
>
> There are a couple of errors in the code that you should have noticed:
> There should not be a space before the colons in the dictionary.
>
> I assume you call the function with "echo Foo()"?
>
> I cannot guess what the problem is, this appears to work fine:
>
> def Foo(): float
> return luaeval('math.pi') 
> enddef
>
> -- 
> I have a watch cat! Just break in and she'll watch.
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// \\\
> \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>

-- 
-- 
You received this message from the "vim_use" 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_use" 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_use/1a8f6ea4-2717-45a5-b89b-14b2a1009a7bn%40googlegroups.com.

Reply via email to