Client APIs
Client-side Lua APIs for MAEngine
Client APIs
These APIs are available in client-side scripts (Client/init.lua).
Core
Client
Local player access and client events
WebUI
HTML/CSS/JS interface system
Store
Bidirectional Lua/JS state synchronization
Input & Interaction
Game State (Read-Only)
Player
Read player values and bind to changes
Entities
Read entity state and bind to value changes
Events
Local events and server communication
Shared APIs
These are also available on client (identical to server):
Client Capabilities
The client handles rendering, input, and UI:
- Input handling - Register and bind keyboard/mouse actions
- WebUI - HTML/CSS/JS interfaces rendered over the game
- Raycasting - Trace from camera or character
- Local state - Read-only access to replicated entity state
-- Client/init.lua
Timer.Delay(0.5, function()
local hud = WebUI.CreateAtScale("HUD", "index.html", 1)
hud:SetFullscreen(true)
end)
Input.Register("Fire", "LeftMouseButton")
Input.Bind("Fire", Input.Pressed, function()
local hit = Trace.FromCamera(10000)
if hit.hit then
Events.CallServer("PlayerFired", { target = hit.entity:GetID() })
end
end)