amuletml / amulet

An ML-like functional programming language
https://amulet.works/
BSD 3-Clause "New" or "Revised" License
324 stars 14 forks source link

Exporting a function with multiple arguments #300

Open s5bug opened 2 years ago

s5bug commented 2 years ago

The C++ side of this application expects my Lua side to look like

{ on_load = function(a, b) --[[ ... --]] end }

yet, when exporting

let on_load a b = a ^ b

I get

do
  local function on_load(a)
    return function(b) return a .. b end
  end
  return { on_load = on_load }
end

And with

let on_load (a , b) = a ^ b

I get

do
  local function on_load(tmp)
    return tmp._1 .. tmp._2
  end
  return { on_load = on_load }
end

How can I export a single function with multiple arguments?