SDK quick linksLaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and sample applications:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | Lua server SDK |
| GitHub repository | lua-server-sdk |
| Sample applications | Lua Lua with HAProxy Lua with OpenResty NGINX |
| Published module | LuaRocks |
Get started
After you complete the Getting Started process, follow these steps to get started using the LaunchDarkly SDK in your Lua application. The Lua server-side SDK is implemented using a foreign function interface that calls the C++ server-side SDK. You need to install the C++ server-side SDK dynamic library somewhere accessible by the linker. To learn more, read C++ SDK reference (server-side).Install the SDK
First, include the library:The Lua SDK uses an SDK keyThe Lua SDK uses an SDK key. Keys are specific to each project and environment. They are available on the SDK keys page under Settings. To learn more about key types, read Keys.
Initialize the client
After you install and import the SDK, create a single, shared instance ofLDClient. Specify your SDK key here to authorize your application to connect to a particular environment within LaunchDarkly.
Calling clientInit initiates a remote call to the LaunchDarkly service to fetch feature flags. This call blocks up for the time that you provide in milliseconds. If you request a feature flag before the client completes initialization, you will receive the default flag value.
Here is an example:
clientInit.
Evaluate a context
You can useclient to check which variation a particular context will receive for a given feature flag.
Here’s how:
Supported features
This SDK supports the following features:- SDK configuration, including
- Aliasing users
- Anonymous contexts and users
- Context configuration
- Flag variation evaluation
- Flag variation evaluation details
- Flushing events
- Getting all flags
- Identifying and changing contexts
- Logging
- Offline
- Private attributes
- Relay Proxy configuration
- Tracking custom events
- Storing data