Perception Lua API
A Visual Studio Code extension that provides enhanced documentation and code completion for the Lua API.

Features
- Ultra-Fast Code Completion: Pre-indexed suggestions that respond instantly, even when typing quickly
- Documentation on Hover: Hover over any function to see detailed information
- Parameter Hints: Shows parameter names and descriptions when writing function calls
- Full API Documentation: Access complete documentation through the command panel with Ctrl+Shift+S
- Intellisense support for Lua in
.lua
files
- Code completion for Perception Lua API
- Function parameter hints
- Hover documentation for API functions
- Access full API documentation with keyboard shortcut Ctrl+Shift+S (Cmd+Shift+S on Mac)
- Support for Counter-Strike 2 (CS2) Extended API with complete documentation
- Latest API Updates: Enhanced memory, filesystem, and rendering functions (April 2025)
Preview
Watch how Perception Lua API enhances your coding experience:

The GIF demonstrates auto-completion as you type namespace names like "render" or "engine", without requiring the dot character, and shows the detailed documentation on hover.
API Namespaces
The extension provides comprehensive documentation for all API namespaces:
- engine: Core engine functions
- winapi: Windows API functions
- fs: File system operations
- input: Keyboard, mouse and input handling
- m: Memory manipulation
- net: Network operations
- proc: Process functions
- render: Drawing and UI functions
- http: Network requests
- socket: Socket programming
- json: JSON parsing and serialization
- time: Time-related functions
- db: Database operations
- trace: Ray tracing functionality
- cs2: Counter-Strike 2 Extended API for game integration
CS2 Extended API
The newly added Counter-Strike 2 Extended API provides functions to interact with CS2 game entities, interfaces, and game state. This includes:
- Access to entity lists and player information
- World-to-screen coordinate conversion
- View matrix and game rule access
- Raycasting via the
trace
namespace
Example usage:
-- Get local player information
local player = cs2.get_local_player()
print("Player pawn address:", player.pawn)
-- Convert 3D world position to 2D screen coordinates
local x, y = cs2.world_to_screen(100, 200, 300)
render.draw_text(x, y, "Enemy spotted!", 255, 0, 0, 255)
-- Perform a raycast
local is_visible = trace.cast(0, 0, 0, 100, 100, 100)
Latest API Additions (April 2025)
The extension now includes documentation for the latest API updates:
🖼️ Enhanced Rendering
- Create bitmaps from files with
render.create_bitmap_from_file()
- Create bitmaps from memory buffers with
render.create_bitmap_from_buffer()
📦 Improved Memory Operations
- String handling in memory buffers:
m.read_string()
, m.write_string()
- Wide string support:
m.read_wide_string()
, m.write_wide_string()
- Query buffer size with
m.get_size()
📁 Extended Filesystem
- Buffer-based file operations:
fs.write_to_file_from_buffer()
, fs.read_from_file_to_buffer()
- Get file size with
fs.get_file_size()
🌐 Enhanced Networking
- Network callbacks now receive both data and the URL
- Data is provided as a memory buffer for flexible processing
Usage
- Type a namespace (like
render
or engine
) to see suggestions immediately
- Type a function name (like
draw
or create
) to see all functions with that name across all namespaces
- Lightning-fast responses: Pre-indexing technology keeps suggestions snappy even when typing quickly
- Smart filtering: Type at least 2 characters for more targeted suggestions
- Hover documentation shows detailed information about functions and parameters
- Access full documentation with keyboard shortcut Ctrl+Shift+S (Cmd+Shift+S on Mac)
License
This project is licensed under the MIT License.