Topic on Extension talk:Scribunto

Jump to navigation Jump to search

Development environment for Scribuntu modules

Daask (talkcontribs)

I'd like to setup a basic development environment for testing Scribuntu modules locally on my computer. Right now, I'm directly editing the Module and then loading my Module/testcases page to see how it turned out. Testing it locally will dramatically speed up my development process. It's no trouble to install Lua itself (I'm on Ubuntu Linux), but Scribuntu uses a unique frame:getParent().args interface rather than conventional Lua arguments which makes switching back and forth from a regular Lua interpreter cumbersome. Has anyone setup a better development environment? Perhaps even just a helper function to turn a simple Lua invocation into a new object which implements the frame:getParent().args interface?

Mr. Stradivarius (talkcontribs)

There aren't any projects for doing anything like this, as far as I know. The only approaches I've used are editing on live websites, and editing on a full local MediaWiki installation with the Scribunto extension installed (using MediaWiki-Vagrant).

However, it is possible to pass in a fake frame object into the functions you are calling from your test cases; maybe that will be enough to let you run your test cases from standard Lua 5.1?

local frame = {getParent = function () return {args = {"first arg", "second arg", foo = "named arg"}} end}
local result = myFunction(frame)

There are a number of other differences from standard Lua in Scribunto as well; it would be a good idea to read up on those so that you know when to expect strange behaviour.

Reply to "Development environment for Scribuntu modules"