Extension:Katsa

MediaWiki extensions manual
Katsa
Release status: experimental
Implementation API
Description Provides spies for Scribunto.
Author(s)
  • John Erling Blad (Jebladtalk)
Compatibility policy Master maintains backward compatibility.
MediaWiki
Database changes No
License GNU General Public License 2.0 or later
Download
README, LDoc
Translate the Katsa extension

Katsa provides a framework for spies.

Installation edit

Katsa depends on modules from the Scribunto extension.

  • Download and place the file(s) in a directory called Katsa in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'Katsa' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage edit

The workflow for spies is to define a graph, and then call on that graph. The definition is done once, but the graph can be reused several times.

local spy = require 'spy'
local carp = spy.newCarp()
local cluck = spy.newCluck()
local croak = spy.newCroak()
local confess = spy.newConfess()

local h = {}

function h.carp()
	carp 'carp carp carp'             -- this will log a one-liner in the console
	cluck 'cluck cluck cluck'         -- this will log a full stack trace
	croak 'croak croak croak'         -- should just bug out and print a one-liner (but Scribuntos implementation of error() is weird)
	confess "confess confess confess" -- bug out and print a full stack trace
end

return h

For further help, see the generated LDoc documentation.

Development edit

For recreating the Vagrant-based development environment, see Katsa: Topics/Vagrant.

See also edit