DebugSleep: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(fixed the example, having to use a number as first argument to debugSleep) |
||
Line 25: | Line 25: | ||
addCommandHandler ( "zzz", | addCommandHandler ( "zzz", | ||
function ( command, sleep ) | function ( command, sleep ) | ||
debugSleep ( | if ( sleep ) then | ||
local ms = tonumber ( sleep ) | |||
if ( ms ) then | |||
debugSleep ( ms ) | |||
end | |||
end | |||
end | end | ||
) | ) |
Latest revision as of 14:35, 27 January 2022
debugSleep freezes the client/server for the specified time. This means that all synchronization, rendering and script execution will stop except HTTP processing invoked by fetchRemote. This function only works, if development mode is enabled by setDevelopmentMode and can be utilised to build a debugger that communicates via HTTP requests with the editor/IDE.
Warning: Only use this function if you know what you are doing! | |
Syntax
bool debugSleep ( int sleep )
Required Arguments
- sleep : An integer value in milliseconds.
Returns
Returns true if the development mode is enabled and arguments are correct, false otherwise.
Requirements
Minimum server version | 1.5.4-9.11306 |
---|---|
Minimum client version | 1.5.4-9.11306 |
Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.4-9.11306" client="1.5.4-9.11306" />
Example
Example 1: This example would add the command to set the client's freeze time.
Click to collapse [-]
ClientaddCommandHandler ( "zzz", function ( command, sleep ) if ( sleep ) then local ms = tonumber ( sleep ) if ( ms ) then debugSleep ( ms ) end end end )
See Also
- addDebugHook
- base64Decode
- base64Encode
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace
- createTrayNotification
- debugSleep
- downloadFile
- decodeString
- encodeString
- fromJSON
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getKeyboardLayout
- getLocalization
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimers
- getTimerDetails
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTimer
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setClipboard
- setDevelopmentMode
- setFPSLimit
- setTimer
- setTransferBoxVisible
- setWindowFlashing
- sha256
- showCol
- showSound
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub