Terraria Wiki

  • Discussions are now available on the Terraria Wiki.
  • Miss the old Hydra Skin? Try out our Hydralize gadget! Visit the preferences page while logged in and turn on the gadget.

READ MORE

Terraria Wiki
Advertisement
Lua logo Documentation The documentation below is transcluded from Module:Percent/doc. (edit | history)

This module provides functionality to the {{percent}} template.


return {
	format = function(frame)
		local str = frame.args[1]
		local format = frame.args[2]
		local dec = frame.args[3]
		
		str = mw.ustring.gsub(str, '([.%d–-][.%s%d–-]*)%s*%%', function(s)
			s = mw.text.trim(s, '')
			s = string.gsub(s, '%.', dec)
			s = string.gsub(format, '%$percentage%$', s)
			return s
		end)
		return str
	end,

}
Advertisement