Skip to content

Commit

Permalink
Implemented Lua.set_package_path().
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Sep 7, 2016
1 parent ae6b3d1 commit eab2cdb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Added `Lua.Thread`.
- Added `Lua.set_global/3`, `Lua.get_global/2`.
- Added `Lua.set_package_path/2`.

## [0.3.0] - 2016-08-08
### Added
Expand Down
6 changes: 6 additions & 0 deletions lib/lua.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ defmodule Lua do
%State{luerl: :luerl.set_table(name, value, state)}
end

@doc "Sets the value of the package.path global variable."
@spec set_package_path(Lua.State.t, binary) :: Lua.State.t
def set_package_path(%State{luerl: _} = state, path) when is_binary(path) do
set_table(state, [:package, :path], path)
end

@spec wrap_callback(fun) :: fun
defp wrap_callback(function) do
fn args, state ->
Expand Down

0 comments on commit eab2cdb

Please sign in to comment.