window
Open the module's external desktop window.
The window table controls a module's external window, the page in its
window/ folder that Sharp shows in an Edge or Chrome app window. Requires
Sharp 0.4.7 (native API 7). The external window guide
builds one step by step.
window.open()
Opens the calling module's window. The window also opens by itself the first time the module starts, unless the player turned "Window on start" off in the Scripts tab.
Returns true, or nil, error when the module has no window/index.html,
the window is already open, the window host is not running, or neither
Microsoft Edge nor Google Chrome is installed. Instant scripts get
nil, "script windows require a module".
if type(window) == "table" then
local opened, failure = window.open()
if not opened then
log.info("window: " .. failure)
end
endCheck type(window) == "table" when the module must also run on an older Sharp.
window.module_id()
Returns the calling module's actual installed ID, including the name assigned
by the Script Store. Available in Sharp 0.4.9 or newer. Instant scripts get
nil, "script windows require a module".
SDK 1.7.19's window_link uses this ID automatically so a Store download,
renamed module or second installed copy connects to its own window. The
module option in WindowLink.New is a fallback for the offline Python host;
it does not override the installed identity inside Sharp.