[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: JSON module
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 31 Aug 2010 14:17:48 +0200
2010/8/31 David Kolf <kolf@gmx.de>:
> Ed schrieb:
>> you plan to leave "pure Lua" option?
>
> LPeg would be optional, the pure Lua functions stay. In my current test
> version you would either have to load the module using
> json = require "dkjson".use_lpeg()
> or
> json = require "dkjson"
> pcall (json.use_lpeg) -- in case it is not known whether LPeg exists
> if you want to use the LPeg module. Otherwise the pure Lua functions
> would stay active.
You can pcall require on lpeg, and only use it if it was successfully
loaded. That way it's transparent to your user.