Blitz3D+ Command Reference

ValidateWorldDocument ( document[,intended_file$] )

Parameters

document - world document handle

intended_file$ (optional) - Save As destination used to resolve relative asset paths

Description

Returns a JSON validation report for a world document.

The caller-owned report contains valid, diagnostics, and counts. Validation never mutates the document.

For the full story, see the Debug World Editor guide.

Requires Extended mode.

See also: SaveWorldDocument, WorldDocumentDiagnostics, WorldDocumentJson.

Example

; ValidateWorldDocument Example
; -----------------------------
; Requires Extended mode.

; Validation reports on the document without changing it
document=CreateWorldDocument("validate-example","Validate Example")
If document=0 Then RuntimeError WorldDocumentError()

report=ValidateWorldDocument(document,"validate-example.world")
If report=0 Then RuntimeError WorldDocumentError()

valid=JsonObjectGet(report,"valid")
diagnostics=JsonObjectGet(report,"diagnostics")
Print "Valid: "+JsonBoolean(valid)
Print "Diagnostics: "+JsonCount(diagnostics)
Print "Revision after validating (unchanged): "+WorldDocumentRevision(document)

FreeJson diagnostics
FreeJson valid
FreeJson report
FreeWorldDocument document

Print ""
Print "Press any key to close the example"
WaitKey

End

Index