v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Template:Scriptdata/doc

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Displays scripts from the Page name/script directory.

Derived from Template:Gamedata, with a few changes specific to displaying syntax highlighting.

Can be given a custom script to display instead:

  • |script= defines the content of the custom entry.
  • Automatically applies <syntaxhighlight lang="lua"> to entries.


Example of a custom script that uses all parameters:

{{Scriptdata
|title=Identity language
|script=
languages.GEN_IDENTITY=function()
    -- just to demonstrate the absolute most basic method of generating one of these
    -- also so that you can just mod stuff to use GEN_IDENTITY
    local tbl={}
    local unempty = function(str1, str2) 
        return str1=='' and str2 or str1
    end
    for k,v in ipairs(world.language.word) do
        local str=''
        str=unempty(str,v.NOUN_SING)
        str=unempty(str,v.ADJ)
        str=unempty(str,v.VERB_FIRST_PRES)
        str=unempty(str,string.lower(v.token))
        tbl[v.token]=str
    end
    return tbl
end
}}

Preliminary scripts have been provided by User:Putnam3145.

CancelHideAbout

Rating Template:Scriptdata/doc