API:CancelTrade
From RoR Wiki
UI Lua API · Trade functions
Version: WAR 1.4.8
Tells the server that the player cancels the current trade.
CancelTrade()
Arguments
None.
Returns
Nothing.
Details
- Sends a "cancel" trade status to the server for the trade partner the client has stored (for example by InitiateTrade).
- The client does not check that a trade is open. The stock trade window only calls it while its window is showing.
- Does nothing if the player object does not exist yet.
- Arguments are not checked; anything passed is ignored.
Errors
None.
Example
Cancelling when the trade window is closed with Escape, from default/ea_tradewindow/source/tradewindow.lua:
-- We do this to ensure that the trade is cancelled if they close the window by hitting escape
if( not EA_Window_Trade.tradeCompleted ) then
CancelTrade()
end
