The basics
Updated a year agoThe basics
example.json
...
"Scripts" : [
{
"Path": "example.nut",
"RunOn": "UI",
"UICallback": {
"After": "example"
}
}
]
example.nut
void function example()
{
loebAdd(0, "Example", exampleFunc()) // loebAdd(headerIndex, identifier, functionOnClick)
// headerIndex can be any number from 0 to 5, corresponding to the headers in the lobby menu: PLAY, CUSTOMIZE, CALLSIGN, NETWORKS, STORE, SETTINGS.
}
This is the minimum required code needed to create a button using loeb. The function example()
runs after any UICallback
(it won't work otherwise) and adds a button in the PLAY
header with the "Example" text that runs the exampleFunc()
function on click.