BrighterScript is a superset of Roku's BrightScript language. Its goal is to provide new functionality and enhanced syntax support to enhance the Roku channel developer experience.
See the following pages for more information:
'mostly useful for plugins that change code based on annotations
@logOnException()
sub doSomething()
'...
end
'instead of `node.callfunc("someMethod", 1, 2, 3)`, you can do this:
node@.someMethod(1, 2, 3)
class Movie
public title as string
private _actors = invalid
public sub getActors()
if m._actors = invalid
m._actors = api_get_actors()
end if
return m._actors
end sub
end class
const API_URL = "https://api.acme.com/v1/"
sub main()
print API_URL
end sub
enum RemoteButton
up = "up"
down = "down"
left = "left"
right = "right"
end enum
namespace util
function toUpper(value as string)
return
end function
end namespace
sub main()
print util.toUpper("hello world")
end sub
import "pkg:/source/util.bs"
sub main()
print util_toUpper("hello world")
end sub
userSettings = getSettingsFromRegistry() ?? {}
Plugins can be used to manipulate code at any point during the program lifecycle.
print /hello world/ig
print SOURCE_FILE_PATH
print SOURCE_LINE_NUM
print FUNCTION_NAME
print SOURCE_FUNCTION_NAME
print SOURCE_LOCATION
print PKG_PATH
print PKG_LOCATION
name = `John Smith`
text = `hello ${name}`
text = `first line text
second line text`
authStatus = user <> invalid ? "logged in" : "not logged in"