Calling map sub with array

Hello,

I’m facing an issue.
In the following code, the last instruction doesn’t work, and I can’t figure out why. Is this a bug?

Using sbasic console version, but the same with other flavours

JFD.

func ctest()
local result={}
sub m_meth(arg)
?arg
end
result.meth=@m_meth
return result
end

arg=[]
c=ctest()

c.meth(1) ’ works
c.meth(1.1) ’ works
c.meth(“1”) ’ works
c.meth({}) ’ works
c.meth(arg) ’ works
call c.meth,[] ’ works

c.meth([]) ’ dont works
’ * COMP-ERROR AT Main:17 *
’ Description:
’ Array: Missing ‘)’, (left side of expression)

Looks like a bug. You could pass an array variable as a workaround. I’ve created an issue in github to investigate/fix.

1 Like

Another error, with array as string

func ctest()
local result={}
sub m_meth(arg)
a=array(arg)
end
result.meth=@m_meth
return result
end

c=ctest()
c.meth(“[1,2,3]”)

  • RTE-ERROR AT test.bas:5 *
    Description:
    Stack underflow