> 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/20230606165700.E0AC61C0642%40moolenaar.net.

Reply via email to