|
Packit |
f9207c |
## Changelog
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.5 (unpublished)
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Provide Optional as a replacement for OrNil. Exports of the latter
|
|
Packit |
f9207c |
have been fixed.
|
|
Packit |
f9207c |
- Provide utility function `raiseError`: Its argument will be thrown as
|
|
Packit |
f9207c |
an error in Lua.
|
|
Packit |
f9207c |
- Add `modifyLuaError`: The function lives in Foreign.Lua.Error and
|
|
Packit |
f9207c |
allows to alter error messages. This is most useful for amending
|
|
Packit |
f9207c |
errors with additional information.
|
|
Packit |
f9207c |
- Fixed a bug in `toList` which left a element on the stack if
|
|
Packit |
f9207c |
deserializing that element lead to an error. This also affected the
|
|
Packit |
f9207c |
FromLuaStack instance for lists.
|
|
Packit |
f9207c |
- Fixed a bug in `pairsFromTable` which left a key-value pair on the
|
|
Packit |
f9207c |
stack if either of them could not be read into the expected type. This
|
|
Packit |
f9207c |
also affected the FromLuaStack instance for Map.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.4
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Make Lua an instance of MonadMask: MonadMask from Control.Monad.Catch
|
|
Packit |
f9207c |
allows to mask asynchronous exceptions. This allows to define a
|
|
Packit |
f9207c |
finalizer for Lua operations.
|
|
Packit |
f9207c |
- Add functions and constants to refer to stack indices: The functions
|
|
Packit |
f9207c |
`nthFromBottom`, `nthFromTop` as well as the constants `stackTop` and
|
|
Packit |
f9207c |
`stackBottom` have been introduced. Numeric constants are less clear,
|
|
Packit |
f9207c |
and named constants can aid readability.
|
|
Packit |
f9207c |
- Add type OrNil: This type can be used when dealing with optional
|
|
Packit |
f9207c |
arguments to Lua functions.
|
|
Packit |
f9207c |
- Add function absindex: it converts the acceptable index `idx` into an
|
|
Packit |
f9207c |
equivalent absolute index (that is, one that does not depend on the
|
|
Packit |
f9207c |
stack top). The function calls `lua_absindex` when compiled with Lua
|
|
Packit |
f9207c |
5.2 or later; for Lua 5.1, it is reimplemented in Haskell.
|
|
Packit |
f9207c |
- Functions in `tasty` which have been deprecated have been replaced
|
|
Packit |
f9207c |
with non-deprecated alternatives.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.3
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Re-export more FunctionCalling helpers in `Foreign.Lua`: The typeclass
|
|
Packit |
f9207c |
`ToHaskellFunction` and the helper function `toHaskellFunction` are
|
|
Packit |
f9207c |
useful when working with functions. Importing them separately from
|
|
Packit |
f9207c |
`Foreign.Lua.FunctionCalling` was an unnecessary burden; they are
|
|
Packit |
f9207c |
therefor now re-exported by the main module.
|
|
Packit |
f9207c |
- Export registry-relatd constants `refnil` and `noref`: The constants
|
|
Packit |
f9207c |
are related to Lua's registry functions (`ref` and `unref`).
|
|
Packit |
f9207c |
- Add helper to convert functions into CFunction: A new helper
|
|
Packit |
f9207c |
`wrapHaskellFunction` is provided. It expects a
|
|
Packit |
f9207c |
HaskellImportedFunction userdata (as produced by
|
|
Packit |
f9207c |
`pushHaskellFunction`) on top of the stack and replaces it with a C
|
|
Packit |
f9207c |
function. The new function converts error values generated with
|
|
Packit |
f9207c |
`lerror` into Lua errors, i.e. it calls `lua_error`.
|
|
Packit |
f9207c |
- Add utility function `setglobal'`: It works like `setglobal`, but
|
|
Packit |
f9207c |
works with packages and nested tables (dot-notation only).
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.2
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Add cabal flag 'export-dynamic': Default behavior is to include all symbols in
|
|
Packit |
f9207c |
the dynamic symbol table, as this enables users to load dynamic lua libraries.
|
|
Packit |
f9207c |
However, it is sometimes desirable to disable, e.g., when compiling a fully
|
|
Packit |
f9207c |
static binary. See jgm/pandoc#3986.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.1
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Increase user-friendlyness of error messages: The error message returned by
|
|
Packit |
f9207c |
`toHaskellFunction` hinted at the fact that the failing function is a Haskell
|
|
Packit |
f9207c |
function. This is mostly unnecessary information and might have confused
|
|
Packit |
f9207c |
users.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.9.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Added cabal flag to allow fully safe garbage collection: Lua garbage
|
|
Packit |
f9207c |
collection can occur in most of the API functions, even in those usually not
|
|
Packit |
f9207c |
calling back into haskell and hence marked as optimizable. The effect of this
|
|
Packit |
f9207c |
is that finalizers which call Haskell functions will cause the program to
|
|
Packit |
f9207c |
hang. A new flag `allow-unsafe-gc` is introduced and enabled by default.
|
|
Packit |
f9207c |
Disabling this flag will mark more C API functions as potentially calling back
|
|
Packit |
f9207c |
into Haskell. This has a serious performance impact.
|
|
Packit |
f9207c |
- `FromLuaStack` and `ToLuaStack` instances for lazy ByteStrings are added.
|
|
Packit |
f9207c |
- None-string error messages are handled properly: Lua allows error messages to
|
|
Packit |
f9207c |
be of any type, but the haskell error handlers expected string values. Tables,
|
|
Packit |
f9207c |
booleans, and other non-string values are now handled as well and converted to
|
|
Packit |
f9207c |
strings.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.8.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Use newtype definitions instead of type aliases for LuaNumber and LuaInteger.
|
|
Packit |
f9207c |
This makes it easier to ensure the correct numeric instances in situations
|
|
Packit |
f9207c |
where Lua might have been compiled with 32-bit numbers.
|
|
Packit |
f9207c |
- Instances of `FromLuaStack` and `ToLuaStack` for `Int` are removed. The
|
|
Packit |
f9207c |
correctness of these instances cannot be guaranteed if Lua was compiled with a
|
|
Packit |
f9207c |
non-standard integer type.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.7.1
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- The flag `lua_32bits` was added to allow users to compile Lua for 32-bit
|
|
Packit |
f9207c |
systems.
|
|
Packit |
f9207c |
- When reading a list, throw an error if the lua value isn't a table instead of
|
|
Packit |
f9207c |
silently returning an empty list.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.7.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
- Tuples from pairs to octuples have been made instances of `FromLuaStack` and
|
|
Packit |
f9207c |
`ToLuaStack`.
|
|
Packit |
f9207c |
- New functions `dostring` and `dofile` are provided to load and run strings and
|
|
Packit |
f9207c |
files in a single step.
|
|
Packit |
f9207c |
- `LuaStatus` was renamed to `Status`, the *Lua* prefix was removed from its
|
|
Packit |
f9207c |
type constructors.
|
|
Packit |
f9207c |
- The constructor `ErrFile` was added to `Status`. It is returned by `loadfile`
|
|
Packit |
f9207c |
if the file cannot be read.
|
|
Packit |
f9207c |
- Remove unused FFI bindings and unused types, including all functions unsafe to
|
|
Packit |
f9207c |
use from within Haskell and the library functions added with 0.5.0. Users with
|
|
Packit |
f9207c |
special requirements should define their own wrappers and raw bindings.
|
|
Packit |
f9207c |
- The module *Foreign.Lua.Api.SafeBindings* was merge into
|
|
Packit |
f9207c |
*Foreign.Lua.Api.RawBindings*.
|
|
Packit |
f9207c |
- FFI bindings are changed to use newtypes where sensible, most notably
|
|
Packit |
f9207c |
`StackIndex`, `NumArgs`, and `NumResults`, but also the newly introduced
|
|
Packit |
f9207c |
newtypes `StatusCode`, `TypeCode`, and `LuaBool`.
|
|
Packit |
f9207c |
- Add functions `tointegerx` and `tonumberx` which can be used to get and check
|
|
Packit |
f9207c |
values from the stack in a single step.
|
|
Packit |
f9207c |
- The signature of `concat` was changed from `Int -> Lua ()` to
|
|
Packit |
f9207c |
`NumArgs -> Lua ()`.
|
|
Packit |
f9207c |
- The signature of `loadfile` was changed from `String -> Lua Int` to
|
|
Packit |
f9207c |
`String -> Lua Status`.
|
|
Packit |
f9207c |
- The type `LTYPE` was renamed to `Type`, its constructors were renamed to
|
|
Packit |
f9207c |
follow the pattern `Type<Typename>`. `LuaRelation` was renamed to
|
|
Packit |
f9207c |
`RelationalOperator`, the *Lua* prefix was removed from its constructors.
|
|
Packit |
f9207c |
- Add function `tolist` to allow getting a generic list from the stack without
|
|
Packit |
f9207c |
having to worry about the overlapping instance with `[Char]`.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.6.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* Supported Lua Versions now include Lua 5.2 and Lua 5.3. LuaJIT and Lua 5.1
|
|
Packit |
f9207c |
remain supported as well.
|
|
Packit |
f9207c |
* Flag `use-pkgconfig` was added to allow discovery of library and include paths
|
|
Packit |
f9207c |
via pkg-config. Setting a specific Lua version flag now implies `system-lua`.
|
|
Packit |
f9207c |
(Sean Proctor)
|
|
Packit |
f9207c |
* The module was renamed from `Scripting.Lua` to `Foreign.Lua`. The code is now
|
|
Packit |
f9207c |
split over multiple sub-modules. Files processed with hsc2hs are restricted to
|
|
Packit |
f9207c |
Foreign.Lua.Api.
|
|
Packit |
f9207c |
* A `Lua` monad (reader monad over LuaState) is introduced. Functions which took
|
|
Packit |
f9207c |
a LuaState as their first argument are changed into monadic functions within
|
|
Packit |
f9207c |
that monad.
|
|
Packit |
f9207c |
* Error handling has been redesigned completely. A new LuaException was
|
|
Packit |
f9207c |
introduced and is thrown in unexpected situations. Errors in lua which are
|
|
Packit |
f9207c |
leading to a `longjmp` are now caught with the help of additional C wrapper
|
|
Packit |
f9207c |
functions. Those no longer lead to uncontrolled program termination but are
|
|
Packit |
f9207c |
converted into a LuaException.
|
|
Packit |
f9207c |
* `peek` no longer returns `Maybe a` but just `a`. A LuaException is thrown if
|
|
Packit |
f9207c |
an error occurs (i.e. in situtations where Nothing would have been returned
|
|
Packit |
f9207c |
previously).
|
|
Packit |
f9207c |
* The `StackValue` typeclass has been split into `FromLuaStack` and
|
|
Packit |
f9207c |
`ToLuaStack`. Instances not satisfying the law `x == push x *> peek (-1)` have
|
|
Packit |
f9207c |
been dropped.
|
|
Packit |
f9207c |
* Documentation of API functions was improved. Most docstrings have been copied
|
|
Packit |
f9207c |
from the official Lua manual, enriched with proper markup and links, and
|
|
Packit |
f9207c |
changed to properly describe hslua specifics when necessary.
|
|
Packit |
f9207c |
* Example programs have been moved to a separate repository.
|
|
Packit |
f9207c |
* Unused files were removed. (Sean Proctor)
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.5.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* New raw functions for `luaopen_base`, `luaopen_package`, `luaopen_string`,
|
|
Packit |
f9207c |
`luaopen_table`, `luaopen_math`, `luaopen_io`, `luaopen_os`, `luaopen_debug`
|
|
Packit |
f9207c |
and their high-level wrappers (with names `openbase`, `opentable` etc.)
|
|
Packit |
f9207c |
implemented.
|
|
Packit |
f9207c |
* Remove custom versions of `loadfile` and `loadstring`.
|
|
Packit |
f9207c |
* Drop support for GHC versions < 7.8, avoid compiler warnings.
|
|
Packit |
f9207c |
* Ensure no symbols are stripped when linking the bundled lua interpreter.
|
|
Packit |
f9207c |
* Simplify `tostring` function definition. (Sean Proctor)
|
|
Packit |
f9207c |
* Explicitly deprecate `strlen`. (Sean Proctor)
|
|
Packit |
f9207c |
* Add links to lua documentation for functions wrapping the official lua C API.
|
|
Packit |
f9207c |
(Sean Proctor).
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.4.1
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* Bugfix(#30): `tolist` wasn't popping elements of the list from stack.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.4.0
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* `pushstring` and `tostring` now uses `ByteString` instead of `[Char]`.
|
|
Packit |
f9207c |
* `StackValue [Char]` instance is removed, `StackValue ByteString` is added.
|
|
Packit |
f9207c |
* `StackValue a => StackValue [a]` instance is added. It pushes a Lua array to
|
|
Packit |
f9207c |
the stack. `pushlist`, `islist` and `tolist` functions are added.
|
|
Packit |
f9207c |
* Type errors in Haskell functions now propagated differently. See the
|
|
Packit |
f9207c |
`Scripting.Lua` documentation for detailed explanation. This should fix
|
|
Packit |
f9207c |
segfaults reported several times.
|
|
Packit |
f9207c |
* `lua_error` function is removed, it's never safe to call in Haskell.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
Related issues and pull requests: #12, #26, #24, #23, #18.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.3.14
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* Pkgconf-based setup removed. Cabal is now using `extra-libraries` to link with Lua.
|
|
Packit |
f9207c |
* `luajit` flag is added to link hslua with LuaJIT.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.3.13
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* Small bugfix related with GHCi running under Windows.
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.3.12
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* `pushrawhsfunction` and `registerrawhsfunction` functions are added.
|
|
Packit |
f9207c |
* `apicheck` flag is added to Cabal package to enable Lua API checking. (useful for debugging)
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
### 0.3.11
|
|
Packit |
f9207c |
|
|
Packit |
f9207c |
* `luaL_ref` and `luaL_unref` functions are added.
|