Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 1.91 KB

File metadata and controls

76 lines (52 loc) · 1.91 KB

Apache OpenDAL™ Lua Binding (WIP)

status: unreleased

A Lua binding for Apache OpenDAL: access the local filesystem, in-memory storage, S3, and 50+ services through one API.

Note: This binding has its own independent version number, which may differ from the Rust core version.

Useful Links

Build and install

Build from source

# Currently only Lua 5.2 is supported (the lua52 Cargo feature).
cd bindings/lua
cargo build --package opendal-lua --release

# Copy the native library to your Lua shared-library directory.
cp ../../target/release/libopendal_lua.so /usr/lib/lua/5.2/opendal.so

Install with LuaRocks

cd bindings/lua
luarocks make

Quickstart

local opendal = require("opendal")

-- Errors are raised as Lua errors; use pcall to catch them.
local ok, op = pcall(opendal.operator.new, "fs", { root = "/tmp" })
if not ok then
    print(op)
    return
end

op:write("test.txt", "hello world")
print("read:", op:read("test.txt"))   -- "hello world"

Run the bundled example:

lua5.2 example/fs.lua

For more examples and full API documentation, see the User guide.

Contributing

Contributions are welcome. Run tests with busted:

busted -o gtest test/opendal_test.lua

License and Trademarks

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.