Skip to content

Instantly share code, notes, and snippets.

@katlogic
Created September 17, 2016 21:36
Show Gist options
  • Save katlogic/13909819cdd5284389a660b5b417e415 to your computer and use it in GitHub Desktop.
Save katlogic/13909819cdd5284389a660b5b417e415 to your computer and use it in GitHub Desktop.
function lookup(t,p)
p:gsub("([^.]*).?", function(c)
if c == "" then return end
t = t[c]
end)
return t
end
print(lookup({a={b={c=1}}},"a.b.c"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment