Extension:Scribunto/Example extension

This page may be used as a resource for people trying to extend Scribunto's library with their own extensions.

YourExtension/YourExtension.php
As with a conventional extension, this file is mostly boilerplate. I'm extracting a lot of information from the file name.

YourExtension/YourExtension.body.php
The body file contains a rudimentary extension of the  class, which registers the interface for this library.

With an existing library
My particular scenario, which may not apply to anyone else, is that I wanted to use LuaSocket to allow fetching the raw content of certain pages and so forth. (This is a private wiki, so I'm not worried about the security implications.)

Of course, simply typing  in a Module: page didn't work. So what to do? Write an extension, apparently.

In the attempt to figure out how the hell this is done, I've figured out the following, which, unfortunately, does not work (it says that 'socket' is not found. Providing absolute and relative paths does not seem to work either, presumably because of the restrictions on the extension's version of  .). I'm not sure if there's any way around this.