PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org
MIT License
388 stars 26 forks source link

Chaining 1 parameter string calls without spaces works in lua 5.4, but not pluto #951

Closed coyo-t closed 2 months ago

coyo-t commented 2 months ago

ex:

-- template/full.lua
return function (tex_name)
  return { texture=tex_name }
end
-- glass.lua
return require'template.full''glass'

will work fine in 5.4, but in pluto it does the C/Python thing of juxtaposed string joining, and will throw a runtime error saying it cant find the script template.fullglass.lua in any of the package paths

adding spaces between the arguments will work fine however

-- glass.lua
return require 'template.full' 'glass'
Sainan commented 2 months ago

Test case:

local function tofs(t)
    local f
    f=|s|->do
        t:insert(s)
        return f
    end
    return f
end
do
    local t = {}
    tofs(t) "abc" "def"
    assert(#t == 2)
    assert(t[1] == "abc")
    assert(t[2] == "def")
end
do
    local t = {}
    tofs(t) "abc""def"
    assert(#t == 2)
    assert(t[1] == "abc")
    assert(t[2] == "def")
end