stduuid
LuaJIT bindings for the embedded stduuid library
Status
Availability
This module is preloaded. You can simply require
it:
local stduuid = require("stduuid")
Fields
cdefs
A string representing the C type definitions that were used to load the FFI bindings. Do not attempt to ffi.load
them manually.
bindings
A pointer to the statically-loaded exports table that exposes the bound functions to Lua. For more details, see this note.
Functions
initialize
Initializes the bindings by loading the C type definitions. Automatically called by the runtime when it sets up the Lua environment
version
Returns the embedded stduuid library version as a Lua string.
Native Bindings
All C functions listed here can be accessed via stduuid.bindings
and must be called with the appropriate cdata
values.
uuid_create_v4
Generates a UUID using the default (basic) random number generator. May produce inferior randomness (see details here).
bool uuid_create_v4(uuid_rfc_string_t* result);
uuid_create_mt19937
Generates a UUID using the mt19937 random number generator. Produces high-quality randomness via Mersenne Twister Engine.
bool uuid_create_mt19937(uuid_rfc_string_t* result)
uuid_create_v5
Generates a name-based UUID using SHA-1 hashing to deterministically produce an identifier based on a given namespace-name-pair.
bool uuid_create_v5(const char* namespace_uuid_str, const char* name, uuid_rfc_string_t* result);
uuid_create_system
Generates a UUID using a nonstandard, platform-specific random number generator. It currently uses the following APIs internally:
- Windows: CoCreateGuid
- Linux: uuid_generate
- Mac OS: CFUUIDCreate
bool uuid_create_system(uuid_rfc_string_t* result)
Changelog
Version | What happened? |
---|---|
v0.0.1 | Initial release |