Skip to content

Instantly share code, notes, and snippets.

@DarkWiiPlayer
Last active August 1, 2019 09:03
Show Gist options
  • Save DarkWiiPlayer/3ade4827ccc692c244af9a71bf9ace78 to your computer and use it in GitHub Desktop.
Save DarkWiiPlayer/3ade4827ccc692c244af9a71bf9ace78 to your computer and use it in GitHub Desktop.
local function tmap(tab, func)
local new = {}
for key, value in pairs(tab) do
new[key] = func(value)
end
return new
end
local terra add(a : int, b : int)
return a + b
end
local function stub(func, ret)
return terra([tmap(add:gettype().parameters, symbol)])
return [ret]
end
end
print(stub(add, 0)(1, 2))

A simple experiment Lua function that generates stubs of provided Terra functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment