-
Notifications
You must be signed in to change notification settings - Fork 0
Class: WebUI
WebUI is a technology that allows you to make UI through HTML/CSS/JS in Garry's Mod.
It is an abstraction over DHTML.
It implies that the player has a Chromium branch *
@argument
Name/ID (string) - unique ID of WebUI's panel
@argument
URL (string) - URL to HTML page, that will be rendered
@argument
SaveOnClose? (boolean) - if true, WebUI will not removed after :Close()
Example
local webui_panel = WebUI:new("Scoreboard", "https://autumngmod.ru/webui/scoreboard")
@description
Returns the panel if it exists, or creates it and returns it.
@argument
Name/ID (string) - unique ID of WebUI's panel
@argument
URL (string) - URL to HTML page, that will be rendered
@argument
SaveOnClose? (boolean) - if true, WebUI will not removed after :Close()
Example
local webui_panel = WebUI:new("Scoreboard", "https://autumngmod.ru/webui/scoreboard")
local ui_panel = WebUI.Prepare("Scoreboard", "https://autumngmod.ru/webui/scoreboard")
print(webui_panel == ui_panel) -- => output: true
-- same panels
@description
Creates/shows WebUI panel depending on the save_on_close parameter in the new constructor method
@argument
Parent? (Panel) - The parent panel on which the WebUI will be opened. This is an optional parameter.
Example
local webui_panel = WebUI:new("Scoreboard", "https://autumngmod.ru/webui/scoreboard")
webui_panel:Open()
@description
Returns DHTML panel of WebUI
@description
Adds Lua table in DHTML's javascript, as variable.
@argument
VariableName (string) - name of variable in JavaScript
@argument
Table (table) - table, that will be pushed in JavaScript
Example
webui_panel:PushTable("example", {
a = 4,
is_funeral_the_best = true
})
@description
Closes/hides WebUI panel depending on the save_on_close parameter in the new constructor method