Fix bug #214:

* Support both Lua 5.1 and 5.2 by adding wrappers around a couple of Lua
API functions which have changed between the versions.