Reference/Native_modules/The_bundled_modules
Every server package ships ready-made modules in Modules/ (Windows .dll, Linux .so). Each one has its own page with every function, examples and its source code:
| Module | What it adds | Source |
|---|---|---|
lu_ini | Read and write INI files (ReadIniString, WriteIniInteger, ...). Section C.2. | Open (C++), in this wiki |
lu_http | Web requests (HTTP / HTTPS, JSON) that never block the server (fetch, GetJson, ...). Section C.3. | Open (C++), in this wiki |
lu_sqlite2 | SQLite databases, object oriented (SQLiteConnection, prepared statements, transactions). Section C.4. Called lu_db before v0.5.5: that file is still shipped, so LoadModule("lu_db") keeps working. | Open (C++), in this wiki |
lu_sqlite | SQLite databases, the procedural module of the original Liberty Unleashed (sqlite_open, sqlite_query). Section C.5. | Binary only (original LU module) |
lu_hashing | MD5 and SHA1 of a string. Section C.6. | Binary only (original LU module) |
Load a module once, at the top of a server script or in onScriptLoad: LoadModule("lu_ini"); returns true when it worked. Instead you can list modules in server.conf (plugins lu_ini lu_http); they are loaded before the scripts. A module is loaded once per server even when several script folders call LoadModule for it. Modules only exist on the server: client scripts cannot load them.
// stop with a clear message when a module file is missing
function onScriptLoad()
{
if (!LoadModule("lu_sqlite2")) { print("lu_sqlite2 is missing from Modules/"); return; }
if (!LoadModule("lu_ini")) { print("lu_ini is missing from Modules/"); return; }
}NoteWhich SQLite module? Use
lu_sqlite2 for new scripts: parameters (no SQL injection), real error messages, 64 bit integers, results that free themselves. lu_sqlite is there for old Liberty Unleashed scripts. Both read and write the same .db files, so you can move a server over table by table.Categories: Native modules