Материал из свободной русской энциклопедии «Традиция»
Перейти к навигации Перейти к поиску

Это страница документации Модуль:Microscope.

Типичный синтаксис вызова из другого модуля Lua:

frame:preprocess ('{{#tag:graphviz|\n' .. require 'Модуль:Microscope' (data, ...) .. '\n}}\n')

, где ... — необязательные аргументы:

a number 
This limits the number of linked values to display. 1 means only the passed Lua value itself, 2 means the value itself and any value that can be reached in 1 step, and so on. Default is 0 which means to follow all links.
any table, userdata, function or thread 
Prunes the resulting graph at the given value. Typical use cases are the microscope function itself, package.loaded or even _G.
"html", "nohtml" 
Enables/disables the generation of HTML code in the .dot files. HTML code is used for prettier tables, but older GraphViz versions cannot handle HTML. If you see strange code in your images, try the "nohtml"-option. Default is "html".
"environments", "noenvironments" 
Enables/disables display of environment tables. Most functions share the global environment and the pictures get quite big, so the default is "noenvironments".
"upvalues", "noupvalues" 
Enables/disables display of upvalues for functions. Default is "upvalues".
"metatables", "nometatables" 
Enables/disables display of metatables for tables/userdata. Default is "metatables".
"leaves", "noleaves" 
Sometimes (when a value is part of a table and does not have any outgoing links), it is unnecessary to draw an extra shape for this value, as it would clutter the image. This option enables/disables the generation of leaf nodes in the graph. Default is "noleaves".
"locals", "nolocals" 
Enables/disables display of a table-like stack with local variables for all suspended and active coroutines. If no coroutine is active, the main stack is displayed as well. Default is "nolocals". All settings that limit graph node output also apply to the references in the stack(s).
"registry", "noregistry" 
Enables/disables display of the Lua registry table. The registry is included as another root node in the graph output. Default is "noregistry". All settings that limit graph node output also apply to the references in the registry.
"sizes", "nosizes" 
If lua-getsize is available in package.cpath, the size of a table, userdata, thread, and function will be added to the label automatically. This setting enables/disables the creation of extra nodes in the graph also showing the object's size. The default is "nosizes".
any other string 
Any other string is used as a label for the graph. If multiple labels are given, only the last one is used.