From 2651bea02974629c5d79d1c4855026f26cd7cb81 Mon Sep 17 00:00:00 2001 From: "Vadim A. Misbakh-Soloviov" Date: Mon, 11 May 2015 15:36:08 +0600 Subject: [PATCH] making luarocks loader optional --- README.md | 4 ++-- src/htmlparser/ElementNode.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 633faa0..2472c69 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ Parse HTML text into a tree of elements with selectors Htmlparser is a listed [LuaRock](http://luarocks.org/repositories/rocks/). Install using [LuaRocks](http://www.luarocks.org/): `luarocks install htmlparser` ###Dependencies -Htmlparser depends on [Lua 5.2](http://www.lua.org/download.html), and on the ["set"][1] LuaRock, which is installed along automatically. To be able to run the tests, [lunitx](https://github.com/dcurrie/lunit) also comes along as a LuaRock +Htmlparser depends on [Lua 5.2](http://www.lua.org/download.html) (while work with LuaJIT, which provides 5.1-compatible ABI), and on the ["lua-set"][1] package, which is installed along automatically. To be able to run the tests, [lunitx](https://github.com/dcurrie/lunit) also comes along as a LuaRock ##Usage Start off with ```lua -require("luarocks.loader") +pcall(require, "luarocks.loader") local htmlparser = require("htmlparser") ``` Then, parse some html: diff --git a/src/htmlparser/ElementNode.lua b/src/htmlparser/ElementNode.lua index 602c695..d249abb 100644 --- a/src/htmlparser/ElementNode.lua +++ b/src/htmlparser/ElementNode.lua @@ -1,4 +1,4 @@ -require("luarocks.loader") +pcall(require, "luarocks.loader") local Set = require("Set") local ElementNode = {}