> 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 -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///