Site Tools


loadinfo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

loadinfo [2006/08/01 04:13] (current)
Line 1: Line 1:
 +# $EPIC: loadinfo.txt,​v 1.2 2006/08/01 04:07:08 sthalik Exp $
 +======Synopsis:​======
 +$__loadinfo__()
 +
 +======Technical:​======
 +   * If the __loadinfo__ function is called when the [[LOAD]] command is not currently executing, the literal string "​-1"​ is returned.
 +   * Otherwise, the __loadinfo__ function returns a three-word list where the first word is the line number in the file being loaded, the second word is the name of the file being loaded, and the third word is "​pf"​ or "​std"​ depending on the loader that was used.
 +
 +======Practical:​======
 +This could be used to reload scripts that were not loaded with the
 +correct loader.
 +
 +======Returns:​======
 +During a /[[LOAD]], the line number and filename of the file being loaded
 +and "​pf"​ if the script was loaded with /[[LOAD]] -pf or "​std"​ if loaded
 +with the standard loader, or -1 if called when no file is currently
 +being loaded.
 +
 +======Examples:​======
 +To make sure that a script is loaded with the pre-formatted loader,
 +put the following at the top of the file:
 +<​file>​
 +if (word(2 $loadinfo()) != [pf]) {
 +    load -pf $word(1 $loadinfo())
 +    return
 +}
 +</​file>​
  
loadinfo.txt ยท Last modified: 2006/08/01 04:13 (external edit)