2010-07-03 51 views
1

让我们考虑这个头:如何获得头值时,源在内存

REBOL [ 
    Title: "Rebodex" 
    Date: 23-May-2010 
    Version: 2.1.1 
    File: %rebodex.r 
    Author: "Carl Sassenrath" 
    Modification: "Rebtut" 
    Purpose: "A simple but useful address book contact database." 
    Email: %carl--rebol--com 
    library: [ 
     level: 'intermediate 
     platform: none 
     type: 'tool 
     domain: [file-handling DB GUI] 
     tested-under: none 
     support: none 
     license: none 
     see-also: none 
    ] 
] 

如果这个脚本是从文件执行:

do %rebodex.r 

我能得到

system/script/header/title 

但是,如果源代码存储在源代码中,则上面的代码会产生错误。那么我怎么能在标题中获得这个标题?可能吗 ?

回答

2

如果我理解正确的问题,你必须在脚本中的变量,例如....

>> script: read rebodex.r 

....你想访问头。

如果这是你想要的,那么很简单:使用负载/头

>> rebodex-header: load/header script 
>> print rebodex-header/title 
Rebodex