Edgeware++ packs allow pack creators to write custom scripts that will be executed while running the pack. Edgeware++ uses a custom language that aims to conform to a subset of Lua. Scripts must be placed in a file called script.lua at the root of a pack and currently the script can't be split into multiple files.
Edgeware++ currently supports the following features of Lua.
-- Single-line comment
--[[
Multi-line comment
]]integer = 1
float = 0.5
string = "Hello world!"
boolean = true
none = nil
local var = "Local variable"
a, b, c = 1, 2, 3
local one, two = "first", 2empty_table = {}
empty_table["key"] = "value"
empty_table.key = "value"
empty_table[1] = "value"
struct_like = {name = "Table", another = true}
array_like = {1, empty_table, "Third"}
dict_like = {["key"] = "value", ["k"] = "v"}(1 + 2) * 3 / (-4) -- Arithmetic
10 > 5 -- Comparisons
(true and true) or (false and false) -- Boolean operatorsdo
local var = 1
return var
endi = 0
while i < 10 do
i = i + 1
endif condition then
print("The condition was true")
elseif other_condtion then
print("The other condition was true")
else
print("Both conditions were false")
endfunction add(a, b)
return a + b
end
add(1, 2)
local function is_two(n)
local two = add(1, 1)
if n == two then
return true
end
return false
end
print(is_two(2))
print(is_two(3))Provides basic Lua functions. Import with require("basic_v1").
print(...): Prints any number of arguments.
...: Variadic arguments.
Provides the core functionality for interacting with Edgeware's features. Import with ew = require("edgeware_v1"), optionally replacing ew with any name of your choice.
ew.after(ms, callback): Schedule a function call after a specified time.
ms: Milliseconds to wait.callback: Function taking no arguments.
ew.roll(chance): Returns true with a given chance.
chance: Chance to return true, integer between 1 and 100.- Returns: True or false.
ew.panic(): Call the panic functionality of Edgeware, closing it.
ew.close_popups(): Close all currently open popups.
ew.set_active_moods(moods): Set the active moods.
moods: List of moods, e.g.,{"furry", "goon"}.
ew.enable_mood(mood): Enable a mood.
mood: The name of a mood.
ew.disable_mood(mood): Disable a mood.
mood: The name of a mood.
ew.progress_corruption(): Progress to the next corruption level, requires corruption to be enabled.
ew.set_wallpaper(filename): Set the user's wallpaper.
filename: Filename in the root of the pack.
ew.connect_on_popup_open(callback): Connect a function to run when any image or video popup is opened.
callback: Function taking no arguments.
ew.connect_on_popup_close(callback): Connect a function to run when any image or video popup is closed.
callback: Function taking no arguments.
ew.set_popup_close_text(text): Set the text on the close button of popups.
text: New text.
ew.set_prompt_command_text(text): Set the command text at the top of prompts.
text: New text.
ew.set_prompt_submit_text(text): Set the text on the submit button of prompts.
text: New text.
ew.set_prompt_min_length(length): Set the minimum length of a prompt, must be less than or equal to the maximum length.
length: Minimum length.
ew.set_prompt_max_length(length): Set the maximum length of a prompt, must be greater than or equal to the minimum length.
length: Maximum length.
ew.open_image(args): Open an image popup.
args: Table with the following optional fields:filename: Filename of an image in theimgdirectory of a pack, if not provided, a random image from the pack is used.on_close: Function taking no arguments called after the popup is closed.
ew.open_video(args): Open a video popup.
args: Table with the following optional fields:filename: Filename of a video in theviddirectory of a pack, if not provided, a random video from the pack is used.on_close: Function taking no arguments called after the popup is closed.
ew.play_audio(args): Play an audio file.
args: Table with the following optional fields:filename: Filename of an audio file in theauddirectory of a pack, if not provided, a random audio file from the pack is used.on_stop: Function taking no arguments called after the audio file stops playing.
ew.open_prompt(args): Open a prompt.
args: Table with the following optional fields:text: Prompt text, if not provided, a random prompt from the pack is used.on_close: Function taking no arguments called after the prompt is closed.
ew.open_web(args): Open a web page in a browser.
args: Table with the following optional fields:url: URL to open, if not provided, a random URL from the pack is used.
ew.open_subliminal(args): Open a subliminal popup.
args: Table with the following optional fields:text: Subliminal text, if not provided, a random subliminal from the pack is used.
ew.send_notification(args)
args: Table with the following optional fields:text: Notification text, if not provided, a random notification from the pack is used.
Older version of the Edgeware module for reference of how early scripting packs worked. Import with require("edgeware_v0").
For new packs, the latest version should be preferred!
- print(...) - Prints any number of arguments through Python's print function
- after(ms, callback) - Calls the function
callbackaftermsmilliseconds - roll(chance) - Rolls a random integer between 1 and 100 and compares it against
chance, if the random number is less than or equal tochance, returns true, otherwise returns false - corrupt() - Progress to the next corruption level
- close_popups() - Close all currently open popups
- set_popup_close_text(text) - Set the popup close button's text to
text - image(filename) - Open an image popup with the image pointed to by
filenameor a random image iffilenameis nil - video(filename) - Open a video popup with the video pointed to by
filenameor a random video iffilenameis nil - audio(filename, on_stop) - Play an audio file pointed to by
filenameor a random audio iffilenameis nil, after the audio has finished playing, calls the functionon_stopif it is not nil - prompt(text, on_close) - Open a prompt with the text
textor a random prompt iftextis nil, after the prompt has been completed, calls the functionon_closeif it is not nil - web(link) - Open the web page
linkor a random web page islinkis nil - subliminal(text) - Show a subliminal message
textor a random subliminal message iftextis nil - notification(text) - Show a notification
textor a random notification iftextis nil