Files
Denso/docs/ScriptEngine/Variables.md
2026-07-03 16:31:37 +07:00

1.2 KiB

Variables / Biến Toàn cục

📋 Overview / Tổng quan

Variables là shared state được chia sẻ giữa tất cả scripts trong ScriptEngine.

🔧 Cách sử dụng / Usage

// Simple variable (không hiện UI)
int counter = 0;
string robotName = "ROBOT001";

// Variable visible trong UI (read-only)
[Variable]
double batteryThreshold = 20.0;

// Variable có thể edit từ UI
[Variable(Writeable = true)]
int maxSpeed = 100;

⚙️ Cách hoạt động / How It Works

  • Stored in ConcurrentDictionary<string, object?>
  • Thread-safe dictionary operations
  • Runtime-only (không persist to database)
  • Property wrappers tự động generate

📊 Variable Attributes / Thuộc tính Variable

  • [Variable]: Variable hiển thị trong UI, read-only
  • [Variable(Writeable = true)]: Variable có thể edit từ UI
  • Không có attribute: Variable không hiển thị trong UI

Last Updated: 2025-11-13