Wapka Platform — Engine Reference

Overview Native Static Lua
Lua Native Static 3 Engines — comparison
EngineTypeBest forKey feature
LuaServer-sideDynamic apps, APIs, custom logicFull Lua scripting with REST API access
NativeNo-codeBlogs, forums, file sharing, CMSPre-built apps, one-click install
StaticStaticSPA, landing pages, git deploy9-layer pipeline, GitHub integration
Code Types — 2 primary
IDNameEngineUse
0TwigHTMLAnyHTML, CSS, JS, Twig templates — general-purpose page logic
29LuaScriptLua onlyServer-side Lua with full platform API access
Limits & access
Codes per page1,000
Code content size5 MB
Position range1–1,000 (lower = runs first)
Permission modelLinux-style perm (0–63). Bits 0–2 = others, bits 3–5 = group. null = unrestricted. Owner + Admin always full access.
Ecosystem — tools & links
Lua Engine REST API Wrappers — Lua → HTTP
api.dataset — Document Store 8
api.dataset.find("col", filter){items, total}
api.dataset.get(id)→ table | nil
api.dataset.create("col", data)→ table
api.dataset.update(id, data, replace)replace=true for full replace
api.dataset.delete(id, permanent)soft (default) or hard
api.dataset.restore(id)→ table
api.dataset.collections()→ string[]
api.dataset.purge_collection("name")admin only
api.users 9
api.users.get(id)→ table | nil
api.users.list(filter){type, level, search, page, limit}
api.users.create(data)→ table
api.users.update(id, data)partial update
api.users.login("user", "pass")→ table
api.users.online(filter)→ items[]
api.users.me()currently logged-in user
api.users.delete(id)soft-delete (sets type=4)
api.users.stats()→ total user count
api.sites 3 | api.auth 2
api.sites
api.sites.get(id) · api.sites.list(page)→ table | items[]
api.sites.current(){id, name, type, config}
api.auth
api.auth.session_create(sid, data) · session_check(sid)OAuth session helpers
api.forums 5 | api.posts 6
api.forums
api.forums.get(id) · api.forums.list(filter){parent, user, search, order, page, limit}
api.forums.create("name", parentId) · rename(id,"n") · delete(id)CRUD
api.posts
api.posts.get(id) · api.posts.list(filter){forum_id, user_id, status, search, order, page, limit}
api.posts.create(data){forum_id, title, content, format, status}
api.posts.update(id, data) · delete(id, hard) · restore(id)CRUD
api.messages 7
api.messages.get(id)→ table | nil
api.messages.send(to, "content")by user ID or username
api.messages.chat(uid, page, limit)→ messages with user
api.messages.conversations() · api.messages.unread()partners list · count
api.messages.edit(id, "content") · delete(id)CRUD
api.files 6 | api.folders 5
api.files
api.files.get(id){url, cdn_url, thumb_url, ...}
api.files.list(filter){folder_id, search, order, page, limit}
api.files.upload(data) · import("url", folderId)multipart · from URL
api.files.rename(id, "n") · delete(id)CRUD
api.folders
api.folders.get(id) · api.folders.list(parentId)→ table | items[]
api.folders.create("n", parentId) · rename(id,"n") · delete(id)CRUD
api.pages 2 | api.codes 9
api.pages
api.pages.get(id) · api.pages.list(filter){search, order, page, limit}
api.codes
api.codes.get(id) · api.codes.list(pageId)→ table | items[]
api.codes.create(pageId, data){content, type, position}
api.codes.update(id, data) · delete(id)CRUD
api.codes.copy(codeId, pageId) · move(codeId, pageId)copy to page · move to page
api.codes.up(codeId) · api.codes.down(codeId)move in execution order
Lua Engine Twig Templates — via ctx:render()
Twig Syntax — quick reference
{{ variable }}auto-escaped output
{{ variable|raw }}unescaped output (trusted content)
{% set var = value %}set variable
{% if condition %} ... {% endif %}conditional
{% for item in items %} ... {% endfor %}loop
{# comment #}comment (not rendered)
Tags 24 allowed in sandbox
if · elseif · else · endif · for · endfor · set · include · extends · block · endblock · macro · endmacro · import · from · spaceless · endspaceless · verbatim · endverbatim · apply · endapply · autoescape · endautoescape · flush
Filters 30+ allowed
upper · lower · capitalize · title · trim · raw · escape · e · length · reverse · first · last · join · split · sort · date · date_modify · format · replace · number_format · abs · round · ceil · floor · json_encode · url_encode · striptags · nl2br · slice · default · keys · batch · column · filter · map · reduce · find
Functions 10 | Loop Variables 5
Functions
range(low, high) · cycle(values, name) · date(format)helpers
max(v1, v2, ...) · min(v1, v2, ...) · random(n)math
attribute(obj, field) · block(name)dynamic access
template_from_string(str)inline template
Loop Variables
loop.index · loop.index0 · loop.first · loop.last · loop.lengthiteration info
Inheritance & Includes
{% extends "layout" %}parent template
{% block name %} ... {% endblock %}block override
{% include "partial" %}include sub-template
{% include "partial" with {key: value} %}include with variables
{% macro name(params) %} ... {% endmacro %}define reusable macro
{% from "macros" import name %}import macros from another template
CSRF / Flash Helpers — in templates
{{ csrf_token() }}generate CSRF token (hidden input value)
{{ flash("key") }}get + consume flash message
{% if has_flash("key") %} ... {% endif %}check flash without consuming