Skip to content

Instantly share code, notes, and snippets.

@mauricioabreu
Created February 24, 2022 11:01
Show Gist options
  • Save mauricioabreu/73fc6844d7941e8d306b82bb3de3eb61 to your computer and use it in GitHub Desktop.
Save mauricioabreu/73fc6844d7941e8d306b82bb3de3eb61 to your computer and use it in GitHub Desktop.
Lua DSL for select func without parentheses
local function select(key)
return function(m)
return m[key]
end
end
local name = select "brand_name" {
year = 1992,
brand = "VW",
name = "Beatle",
brand_name = "Fusquinha",
}
print(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment