See the Lua part of #450
See the Lua part of #450