REBOL [
    Title: "Script"
    Date: 3-Jul-2002
    Name: Script
    Version: 1.0.0
    File: %Script.r
    Author: "Andrew Martin"
    Purpose: "Returns the script source code for a word."
    Email: Al.Bri@xtra.co.nz
    Web: http://valley.150m.com
    Category: [util script 3]
]

Script: func [
    "Returns the script source code for a word."
    Word [word!]
    ] [
    join {} [
        Word ": "
        either not value? Word [
            "undefined"
            ] [
            either any [
                native? get Word
                op? get Word
                action? get Word
                ] [
                join "native" mold third get Word
                ] [
                either not error? try [get get Word] [
                    join {'} get Word   ; show a literal word.
                    ] [
                    mold get Word
                    ]
                ]
            ]
        ]
    ]