And a Lua impl