Skip to content
SemanticMediaWiki Lua integration framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/SMW/Lua
tests/phpunit/Library
.gitignore
.travis.yml
COPYING
Lua.php
README.md
composer.json
phpunit.xml.dist

README.md

SemanticMediaWiki Lua

Library containing an integration framework that provides Lua (Scripunto) libraries, allowing an end-user to write modules and expose additional functionality using the {{#invoke: ... }} parser function.

Libraries

Example

-- Module:SMW/Property
local p = {}

-- Return property type
function p.type(frame)

	if not mw.smw.property then
		return "mw.smw.property module not found"
	end

	if frame.args[1] == nil then
		return "no parameter found"
	else
		type = mw.smw.property.getPropertyType( frame.args[1] )
	end

	if type == nil then
		return "(no values)"
	end

	return type
end
return p
{{#invoke:SMW/Property|type|Modification date}} will return "_dat"
{{#invoke:SMW/Property|type}}</code> will return "no parameter found"

Tests

This library comes with a set of PHPUnit and Lua tests (see details on how to write Lua/Scribunto unit tests).

You can’t perform that action at this time.