Public exportsΒΆ

In order to use an instance or procedure from another script file, you can declare it as public by listing it in the public section of the script:

    (script# MYSPECIALSCRIPT)       ; MYSPECIALSCRIPT is a number defined in, say.

            SomeProcedure 0
            AngryTalker 1

    (procedure (SomeProcedure param1)

    (instance AngryTalker of Talker

If the above script was called, then you could “use” FooBar in another script in order to call the public procedures in

    (use FooBar)

    (procedure (SomeProc)
            (SomeProcedure 6)       ; Because we declared we were using FooBar, we can call public procedures in

In the rare cases where you need to use a public instances, it is a little more complicated. For this, we need to use the ScriptID kernel. It will return the object ID for the object located at a particular index in a particular script number:

(procedure (SomeProc &tmp theTalker)
        (= theTalker (ScriptID MYSPECIALSCRIPT 1))      ; export 1 of script# MYSPECIALSCRIPT
        (Printf {The talker's name is %s} (theTalker name:))