Roku BrightScript is a powerful scripting language that makes it easy and quick to build media and networked applications for embedded devices. The language has integrated support for BrightScript Components, a library of lightweight components. The APIs of the platform (device) BrightScript is running on are all exposed to BrightScript as BrightScript Components.
This document specifies the syntax of the language. To write useful applications, you should also refer to the BrightScript Component Reference Manual for the device you are targeting code for. This manual is designed for people that have some experience programming software. It is a reference guide, not a tutorial.
BrightScript compiles code into bytecode that is run by an interpreter. This compilation step happens every time a script is loaded and run. There is no separate compile step that results in a binary file being saved. In this way it is similar to JavaScript.
BrightScript statement syntax is not C-like; in this way it is similar to Python or Basic or Ruby or Lua. BrightScript Objects and named entry data structures are Associative Arrays; in this way it is similar to JavaScript or Lua. BrightScript supports dynamic typing (like JavaScript), or declared types (like C or Java). BrightScript uses "interfaces" and "components" for its APIs; similar to ".Net" or Java.
BrightScript is a powerful bytecode interpreted scripting language optimized for embedded devices; in this way it is unique. For example, BrightScript and the BrightScript Component architecture are written in 100% C for speed, efficiency, and portability. BrightScript makes extensive use of the "integer" type (since many embedded processors don't have floating point units). This is different from languages like JavaScript where a number is always a float. BrightScript numbers are only floats when necessary.
BrightScript is optimized to be the "glue" that connects underlying components for network connectivity, media playback, and UI screens into user friendly applications with minimal programmer effort.
- Statement Summary
- Expressions, Variables, and Types
- Component Architecture
- Program Statements
- Runtime Functions
- Global Utility Functions
- Global String Functions
- Global Math Functions
- Reserved Words
- Conditional Compilation