Move two functions from LuaUtils