Skip to content

Duel.SortDecktop ​

Signature ​

lua
Duel.SortDecktop(int sort_player, int target_player, int count) -> void

Description ​

Lets sort_player reorder the top count cards of target_player's Main Deck. Both players must be valid and count must be at least 1. If count is larger than the remaining Deck size, the processor only sorts the available top cards.

Parameters ​

  • sort_player int
  • target_player int
  • count int

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4893

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 62 indexed script(s).
  • Search this function in the Script Explorer with Duel.SortDecktop.
CardIDScriptDetected Calls
Flower Cardian Peony with Butterfly57261568Scripts/c57261568.lua1
Purrely25550531Scripts/c25550531.lua1
Materiactor Meltthrough66059345Scripts/c66059345.lua1
Loris, Lady of Lament50699850Scripts/c50699850.lua1
Destiny HERO - Dominance69394324Scripts/c69394324.lua1
Shadowreaver Knight 2195506252Scripts/c95506252.lua1
Materiactor Meltdown38669664Scripts/c38669664.lua2
Magikey Mechmusket - Batosbuster19489718Scripts/c19489718.lua1
Adamancipator Risen - Leonite47674738Scripts/c47674738.lua1
Adamancipator Risen - Raptite73079836Scripts/c73079836.lua1
Speedroid Fuki-Modoshi Piper50482813Scripts/c50482813.lua1
Wannabee!3248469Scripts/c3248469.lua1
Hydralander Orbit93953933Scripts/c93953933.lua2
GMX Chairman Kimridge56034579Scripts/c56034579.lua1
Morphtronic Smartfon15521027Scripts/c15521027.lua1
Pot of Prosperity84211599Scripts/c84211599.lua1
Way Where There's a Will91880660Scripts/c91880660.lua1
Invincible Demise Lord71108540Scripts/c71108540.lua1
Sylvan Lotuswain73136204Scripts/c73136204.lua2
Recardination73271204Scripts/c73271204.lua1
Dark Magical Circle47222536Scripts/c47222536.lua2
SPYRAL GEAR - Drone4474060Scripts/c4474060.lua1
Orea, the Sylvan High Arbiter95239444Scripts/c95239444.lua2
Adamancipator Risen - Dragite9464441Scripts/c9464441.lua1
...and 38 more

Script Examples ​

Flower Cardian Peony with Butterfly (57261568) ​

Source: Scripts/c57261568.lua

lua
			Duel.ConfirmCards(tp,g)
			local opt=Duel.SelectOption(tp,aux.Stringid(57261568,1),aux.Stringid(57261568,2))
			Duel.SortDecktop(tp,1-tp,ct)
			if opt==1 then
				for i=1,ct do

Purrely (25550531) ​

Source: Scripts/c25550531.lua

lua
	end
	if ct<=1 then return end
	Duel.SortDecktop(p,p,ct)
	for i=1,ct do
		local mg=Duel.GetDecktopGroup(p,1)

Materiactor Meltthrough (66059345) ​

Source: Scripts/c66059345.lua

lua
	local g=Duel.GetDecktopGroup(tp,6)
	if g:GetCount()>0 then
		Duel.SortDecktop(tp,tp,g:GetCount())
	end
end