mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
4443 lines
141 KiB
HTML
4443 lines
141 KiB
HTML
|
|
|
|
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<title>Gui core</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="../spectre.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="../spectre-icons.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container grid-1280">
|
|
<div class="columns">
|
|
|
|
<!-- sidebar start -->
|
|
|
|
<div id="sidebar" class="column col-3 col-sm-12">
|
|
|
|
<div class="sidebar-custom">
|
|
|
|
<div class="project-infobox">
|
|
|
|
<!-- project title -->
|
|
|
|
<a href="../index.html"><h1>ExpGaming Scenario</h1></a>
|
|
|
|
<!-- project description -->
|
|
<p class="project-desc">Explosive Gaming's server scenario for 0.18</p>
|
|
|
|
<!-- project full description -->
|
|
</div>
|
|
|
|
|
|
<!-- sidebar navigation -->
|
|
<!-- list of items in a module -->
|
|
<ul class="nav nav-module-contents">
|
|
<li class="nav-item">
|
|
<h2>Sections</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><a href="#Dependencies"><span class="fragment-hashtag">#</span> Dependencies</a></li>
|
|
<li class="nav-item"><a href="#Tables"><span class="fragment-hashtag">#</span> Tables</a></li>
|
|
<li class="nav-item"><a href="#Fields"><span class="fragment-hashtag">#</span> Fields</a></li>
|
|
<li class="nav-item"><a href="#Core_Defines"><span class="fragment-hashtag">#</span> Core Defines </a></li>
|
|
<li class="nav-item"><a href="#Defines"><span class="fragment-hashtag">#</span> Defines </a></li>
|
|
<li class="nav-item"><a href="#Helper_Functions"><span class="fragment-hashtag">#</span> Helper Functions </a></li>
|
|
<li class="nav-item"><a href="#Left_Flow"><span class="fragment-hashtag">#</span> Left Flow </a></li>
|
|
<li class="nav-item"><a href="#Element_Define"><span class="fragment-hashtag">#</span> Element Define </a></li>
|
|
<li class="nav-item"><a href="#Element_Events"><span class="fragment-hashtag">#</span> Element Events </a></li>
|
|
<li class="nav-item"><a href="#Top_Flow"><span class="fragment-hashtag">#</span> Top Flow </a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Core</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Async.html"><span class="module-name-item">Async</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Commands.html"><span class="module-name-item">Commands</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Common.html"><span class="module-name-item">Common</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Datastore.html"><span class="module-name-item">Datastore</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/External.html"><span class="module-name-item">External</span></a></div></li>
|
|
<li class="nav-item active"><div class="nav-item-block-active block"><a href="../core/Gui.html"><span class="module-name-item">Gui</span></a><i class="icon icon-arrow-left icon-arrow-left-custom"></i></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Groups.html"><span class="module-name-item">Groups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/PlayerData.html"><span class="module-name-item">PlayerData</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Roles.html"><span class="module-name-item">Roles</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Control</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Jail.html"><span class="module-name-item">Jail</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Production.html"><span class="module-name-item">Production</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Protection.html"><span class="module-name-item">Protection</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Reports.html"><span class="module-name-item">Reports</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Rockets.html"><span class="module-name-item">Rockets</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Selection.html"><span class="module-name-item">Selection</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Tasks.html"><span class="module-name-item">Tasks</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Warnings.html"><span class="module-name-item">Warnings</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Warps.html"><span class="module-name-item">Warps</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Addons</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Advanced-Start.html"><span class="module-name-item">Advanced-Start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/afk-kick.html"><span class="module-name-item">afk-kick</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Chat-Popups.html"><span class="module-name-item">Chat-Popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Chat-Reply.html"><span class="module-name-item">Chat-Reply</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Compilatron.html"><span class="module-name-item">Compilatron</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Damage-Popups.html"><span class="module-name-item">Damage-Popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Death-Logger.html"><span class="module-name-item">Death-Logger</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Discord-Alerts.html"><span class="module-name-item">Discord-Alerts</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Inventory-Clear.html"><span class="module-name-item">Inventory-Clear</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Pollution-Grading.html"><span class="module-name-item">Pollution-Grading</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/protection-jail.html"><span class="module-name-item">protection-jail</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/report-jail.html"><span class="module-name-item">report-jail</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Scorched-Earth.html"><span class="module-name-item">Scorched-Earth</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Spawn-Area.html"><span class="module-name-item">Spawn-Area</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Tree-Decon.html"><span class="module-name-item">Tree-Decon</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Guis</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Autofill.html"><span class="module-name-item">Autofill</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Player-List.html"><span class="module-name-item">Player-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Readme.html"><span class="module-name-item">Readme</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Rocket-Info.html"><span class="module-name-item">Rocket-Info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Science-Info.html"><span class="module-name-item">Science-Info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/server-ups.html"><span class="module-name-item">server-ups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Task-List.html"><span class="module-name-item">Task-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Warps-List.html"><span class="module-name-item">Warps-List</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Data</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Alt-View.html"><span class="module-name-item">Alt-View</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Bonus.html"><span class="module-name-item">Bonus</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Greetings.html"><span class="module-name-item">Greetings</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Player-Colours.html"><span class="module-name-item">Player-Colours</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Quickbar.html"><span class="module-name-item">Quickbar</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../data/Tag.html"><span class="module-name-item">Tag</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Commands</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Admin-Chat.html"><span class="module-name-item">Admin-Chat</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Admin-Markers.html"><span class="module-name-item">Admin-Markers</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Cheat-Mode.html"><span class="module-name-item">Cheat-Mode</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Clear-Inventory.html"><span class="module-name-item">Clear-Inventory</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Connect.html"><span class="module-name-item">Connect</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Debug.html"><span class="module-name-item">Debug</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Find.html"><span class="module-name-item">Find</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Help.html"><span class="module-name-item">Help</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Home.html"><span class="module-name-item">Home</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Interface.html"><span class="module-name-item">Interface</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Jail.html"><span class="module-name-item">Jail</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Kill.html"><span class="module-name-item">Kill</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/LastLocation.html"><span class="module-name-item">LastLocation</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Me.html"><span class="module-name-item">Me</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Protection.html"><span class="module-name-item">Protection</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Rainbow.html"><span class="module-name-item">Rainbow</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Repair.html"><span class="module-name-item">Repair</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Reports.html"><span class="module-name-item">Reports</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Roles.html"><span class="module-name-item">Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/InventorySearch.html"><span class="module-name-item">InventorySearch</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Spawn.html"><span class="module-name-item">Spawn</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Spectate.html"><span class="module-name-item">Spectate</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Teleport.html"><span class="module-name-item">Teleport</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Warnings.html"><span class="module-name-item">Warnings</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Configs</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/File-Loader.html"><span class="module-name-item">File-Loader</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Advanced-Start.html"><span class="module-name-item">Advanced-Start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Bonuses.html"><span class="module-name-item">Bonuses</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Chat-Reply.html"><span class="module-name-item">Chat-Reply</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Compilatron.html"><span class="module-name-item">Compilatron</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Death-Logger.html"><span class="module-name-item">Death-Logger</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Discord-Alerts.html"><span class="module-name-item">Discord-Alerts</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Admin.html"><span class="module-name-item">Commands-Auth-Admin</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Roles.html"><span class="module-name-item">Commands-Auth-Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Color-Parse.html"><span class="module-name-item">Commands-Color-Parse</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Parse.html"><span class="module-name-item">Commands-Parse</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Parse-Roles.html"><span class="module-name-item">Commands-Parse-Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Runtime-Disable.html"><span class="module-name-item">Commands-Auth-Runtime-Disable</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Permission-Groups.html"><span class="module-name-item">Permission-Groups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Roles.html"><span class="module-name-item">Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Autofill.html"><span class="module-name-item">Autofill</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Player-List.html"><span class="module-name-item">Player-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Rockets.html"><span class="module-name-item">Rockets</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Science.html"><span class="module-name-item">Science</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Tasks.html"><span class="module-name-item">Tasks</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Warps.html"><span class="module-name-item">Warps</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/inventory_clear.html"><span class="module-name-item">inventory_clear</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Pollution-Grading.html"><span class="module-name-item">Pollution-Grading</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Popup-Messages.html"><span class="module-name-item">Popup-Messages</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Preset-Player-Colours.html"><span class="module-name-item">Preset-Player-Colours</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Preset-Player-Quickbar.html"><span class="module-name-item">Preset-Player-Quickbar</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Repair.html"><span class="module-name-item">Repair</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Scorched-Earth.html"><span class="module-name-item">Scorched-Earth</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Spawn-Area.html"><span class="module-name-item">Spawn-Area</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Statistics.html"><span class="module-name-item">Statistics</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Warnings.html"><span class="module-name-item">Warnings</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Modules</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/control.html"><span class="module-name-item">control</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.addons.station-auto-name.html"><span class="module-name-item">modules.addons.station-auto-name</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/overrides.debug.html"><span class="module-name-item">overrides.debug</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/overrides.math.html"><span class="module-name-item">overrides.math</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/overrides.table.html"><span class="module-name-item">overrides.table</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.event.html"><span class="module-name-item">utils.event</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.event_core.html"><span class="module-name-item">utils.event_core</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.task.html"><span class="module-name-item">utils.task</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Topics</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../topics/README.md.html"><span class="module-name-item">README.md</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../topics/LICENSE.html"><span class="module-name-item">LICENSE</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
<div class="up-to-top">
|
|
<!-- list of items in a module -->
|
|
<ul class="nav nav-module-contents">
|
|
<li class="nav-item">
|
|
<h4>Jump to Section</h4>
|
|
<ul class="nav">
|
|
<li class="nav-item"><a href="#Dependencies"><span class="fragment-hashtag">#</span> Dependencies</a></li>
|
|
<li class="nav-item"><a href="#Tables"><span class="fragment-hashtag">#</span> Tables</a></li>
|
|
<li class="nav-item"><a href="#Fields"><span class="fragment-hashtag">#</span> Fields</a></li>
|
|
<li class="nav-item"><a href="#Core_Defines"><span class="fragment-hashtag">#</span> Core Defines </a></li>
|
|
<li class="nav-item"><a href="#Defines"><span class="fragment-hashtag">#</span> Defines </a></li>
|
|
<li class="nav-item"><a href="#Helper_Functions"><span class="fragment-hashtag">#</span> Helper Functions </a></li>
|
|
<li class="nav-item"><a href="#Left_Flow"><span class="fragment-hashtag">#</span> Left Flow </a></li>
|
|
<li class="nav-item"><a href="#Element_Define"><span class="fragment-hashtag">#</span> Element Define </a></li>
|
|
<li class="nav-item"><a href="#Element_Events"><span class="fragment-hashtag">#</span> Element Events </a></li>
|
|
<li class="nav-item"><a href="#Top_Flow"><span class="fragment-hashtag">#</span> Top Flow </a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<a href="#">Top <i class="icon icon-upward"></i></a>
|
|
</div>
|
|
</div>
|
|
<!-- sidebar end -->
|
|
|
|
<!-- content body start -->
|
|
<div class="column col-9 col-sm-12">
|
|
|
|
<!-- module list on the main page start -->
|
|
<!-- module list on the main page end -->
|
|
|
|
<!-- module contents -->
|
|
|
|
<!-- module content header start -->
|
|
|
|
<h2><span class="body-module-name"><strong><em>Gui</em></strong></span> core</h2>
|
|
<p>Core Module - Gui
|
|
- Used to simplify gui creation using factory functions called element defines</p>
|
|
<p></p>
|
|
|
|
|
|
<!-- module info start -->
|
|
<!-- module info end -->
|
|
|
|
<!-- module usage start -->
|
|
<h3>Usage</h3>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- To draw your element you only need to call the factory function
|
|
</span><span class="comment">-- You are able to pass any other arguments that are used in your custom functions but the first is always the parent element
|
|
</span><span class="keyword">local</span> example_button_element = example_button(parent_element)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Making a factory function for a button with the caption "Example Button"
|
|
</span><span class="comment">-- This method has all the same features as LuaGuiElement.add
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>
|
|
}</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Making a factory function for a button which is contained within a flow
|
|
</span><span class="comment">-- This method is for when you still want to register event handlers but cant use the table method
|
|
</span><span class="keyword">local</span> example_flow_with_button =
|
|
Gui.element(<span class="keyword">function</span>(event_trigger, parent, ...)
|
|
<span class="comment">-- ... shows that all other arguments from the factory call are passed to this function
|
|
</span> <span class="comment">-- Here we are adding a flow which we will then later add a button to
|
|
</span> <span class="keyword">local</span> flow =
|
|
parent.add{ <span class="comment">-- paraent is the element which is passed to the factory function
|
|
</span> name = <span class="string">'example_flow'</span>,
|
|
<span class="global">type</span> = <span class="string">'flow'</span>
|
|
}
|
|
|
|
<span class="comment">-- Now we add the button to the flow that we created earlier
|
|
</span> <span class="keyword">local</span> element =
|
|
flow.add{
|
|
name = event_trigger, <span class="comment">-- event_trigger should be the name of any elements you want to trigger your event handlers
|
|
</span> <span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>
|
|
}
|
|
|
|
<span class="comment">-- You must return a new element, this is so styles can be applied and returned to the caller
|
|
</span> <span class="comment">-- You may return any of your elements that you added, consider the context in which it will be used for which should be returned
|
|
</span> <span class="keyword">return</span> element
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Styles can be added to any element define, simplest way mimics LuaGuiElement.style[key] = value
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>,
|
|
style = <span class="string">'forward_button'</span> <span class="comment">-- factorio styles can be applied here
|
|
</span>}
|
|
:style{
|
|
height = <span class="number">25</span>, <span class="comment">-- same as element.style.height = 25
|
|
</span> width = <span class="number">100</span> <span class="comment">-- same as element.style.width = 25
|
|
</span>}</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Styles can also have a custom function when the style is dynamic and depends on other factors
|
|
</span><span class="comment">-- Use this method if your style is dynamic and depends on other factors
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>,
|
|
style = <span class="string">'forward_button'</span> <span class="comment">-- factorio styles can be applied here
|
|
</span>}
|
|
:style(<span class="keyword">function</span>(style, element, ...)
|
|
<span class="comment">-- style is the current style object for the elemenent
|
|
</span> <span class="comment">-- element is the element that is being changed
|
|
</span> <span class="comment">-- ... shows that all other arguments from the factory call are passed to this function
|
|
</span> <span class="keyword">local</span> player = game.players[element.player_index]
|
|
style.height = <span class="number">25</span>
|
|
style.width = <span class="number">100</span>
|
|
style.font_color = player.color
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- You are able to register event handlers to your elements, these can be factorio events or custom ones
|
|
</span><span class="comment">-- All events are checked to be valid before raising any handlers, this means element.valid = true and player.valid = true
|
|
</span>Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>
|
|
}
|
|
:on_click(<span class="keyword">function</span>(player, element, event)
|
|
<span class="comment">-- player is the player who interacted with the element to cause the event
|
|
</span> <span class="comment">-- element is a refrence to the element which caused the event
|
|
</span> <span class="comment">-- event is a raw refrence to the event data if player and element are not enough
|
|
</span> player.<span class="global">print</span>(<span class="string">'Clicked: '</span>..element.name)
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Example from core_defines, Gui.core_defines.hide_left_flow, called like: hide_left_flow(parent_element)
|
|
</span><span class="comment">--- Button which hides the elements in the left flow, shows inside the left flow when frames are visible
|
|
</span><span class="comment">-- @element hide_left_flow
|
|
</span><span class="keyword">local</span> hide_left_flow =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'sprite-button'</span>,
|
|
sprite = <span class="string">'utility/close_black'</span>,
|
|
style = <span class="string">'tool_button'</span>,
|
|
tooltip = {<span class="string">'expcore-gui.left-button-tooltip'</span>}
|
|
}
|
|
:style{
|
|
padding = -<span class="number">3</span>,
|
|
width = <span class="number">18</span>,
|
|
height = <span class="number">20</span>
|
|
}
|
|
:on_click(<span class="keyword">function</span>(player, _,_)
|
|
Gui.hide_left_flow(player)
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Eample from defines, Gui.alignment, called like: Gui.alignment(parent, name, horizontal_align, vertical_align)
|
|
</span><span class="comment">-- Notice how _ are used to blank arguments that are not needed in that context and how they line up with above
|
|
</span>Gui.alignment =
|
|
Gui.element(<span class="keyword">function</span>(_, parent, name, _,_)
|
|
<span class="keyword">return</span> parent.add{
|
|
name = name <span class="keyword">or</span> <span class="string">'alignment'</span>,
|
|
<span class="global">type</span> = <span class="string">'flow'</span>,
|
|
}
|
|
<span class="keyword">end</span>)
|
|
:style(<span class="keyword">function</span>(style, _,_, horizontal_align, vertical_align)
|
|
style.padding = {<span class="number">1</span>, <span class="number">2</span>}
|
|
style.vertical_align = vertical_align <span class="keyword">or</span> <span class="string">'center'</span>
|
|
style.horizontal_align = horizontal_align <span class="keyword">or</span> <span class="string">'right'</span>
|
|
style.vertically_stretchable = style.vertical_align ~= <span class="string">'center'</span>
|
|
style.horizontally_stretchable = style.horizontal_align ~= <span class="string">'center'</span>
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- module usage end -->
|
|
|
|
<!-- module content header end -->
|
|
|
|
<!-- module section list start -->
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Dependencies">Dependencies</a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#utils.event">utils.event</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#mod-gui">mod-gui</a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Tables">Tables</a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#events">events</a></td>
|
|
<td class="summary">String indexed table used to avoid conflict with custom event names, similar to how defines.events works</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#defines">defines</a></td>
|
|
<td class="summary">Uid indexed array that stores all the factory functions that were defined, no new values will be added during runtime</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#core_defines">core_defines</a></td>
|
|
<td class="summary">An string indexed table of all the defines which are used by the core of the gui system, used for internal refrence</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#file_paths">file_paths</a></td>
|
|
<td class="summary">Used to store the file names where elements were defined, this can be useful to find the uid of an element, mostly for debuging</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#debug_info">debug_info</a></td>
|
|
<td class="summary">Used to store extra infomation about elements as they get defined such as the params used and event handlers registered to them</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#_prototype_element">_prototype_element</a></td>
|
|
<td class="summary">The prototype used to store the functions of an element define</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#_mt_element">_mt_element</a></td>
|
|
<td class="summary">The prototype metatable applied to new element defines</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Fields">Fields</a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#uid">uid</a></td>
|
|
<td class="summary">The current highest uid that is being used by a define, will not increase during runtime</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Core_Defines">Core Defines </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#hide_top_flow">hide_top_flow</a></td>
|
|
<td class="summary">Button which toggles the top flow elements, version which shows inside the top flow when top flow is visible</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#show_top_flow">show_top_flow</a></td>
|
|
<td class="summary">Button which toggles the top flow elements, version which shows inside the left flow when top flow is hidden</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#hide_left_flow">hide_left_flow</a></td>
|
|
<td class="summary">Button which hides the elements in the left flow, shows inside the left flow when frames are visible</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Defines">Defines </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#alignment">alignment</a></td>
|
|
<td class="summary">Draw a flow used to align its child elements, default is right align</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#scroll_table">scroll_table</a></td>
|
|
<td class="summary">Draw a scroll pane that has a table inside of it</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#header">header</a></td>
|
|
<td class="summary">Used to add a frame with the header style, has the option for a right alignment flow for buttons</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#footer">footer</a></td>
|
|
<td class="summary">Used to add a frame with the footer style, has the option for a right alignment flow for buttons</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#container">container</a></td>
|
|
<td class="summary">Used for left frames to give them a nice boarder</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#bar">bar</a></td>
|
|
<td class="summary">Used to make a solid white bar in a gui</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#centered_label">centered_label</a></td>
|
|
<td class="summary">Used to make a label which is centered and of a certian size</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#title_label">title_label</a></td>
|
|
<td class="summary">Used to make a title which has two bars on either side</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Helper_Functions">Helper Functions </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#get_player_from_element">get_player_from_element(element)</a></td>
|
|
<td class="summary">Get the player that owns a gui element</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toggle_enabled_state">toggle_enabled_state(element[, state])</a></td>
|
|
<td class="summary">Will toggle the enabled state of an element or set it to the one given</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toggle_visible_state">toggle_visible_state(element[, state])</a></td>
|
|
<td class="summary">Will toggle the visible state of an element or set it to the one given</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#destroy_if_valid">destroy_if_valid(element)</a></td>
|
|
<td class="summary">Destory a gui element without causing any errors, often because the element was already removed</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#sprite_style">sprite_style(size[, padding=-2][, style])</a></td>
|
|
<td class="summary">Returns a table to be used as the style for a sprite buttons, produces a sqaure button</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Left_Flow">Left Flow </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#left_elements">left_elements</a></td>
|
|
<td class="summary">Contains the uids of the elements that will shown on the left flow and their join functions</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_left_flow">get_left_flow(player)</a></td>
|
|
<td class="summary">Gets the flow refered to as the left flow, each player has one left flow</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element:add_to_left_flow">Gui._prototype_element:add_to_left_flow([open_on_join])</a></td>
|
|
<td class="summary">Sets an element define to be drawn to the left flow when a player joins, includes optional check</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#left_toolbar_button">left_toolbar_button(sprite, tooltip, element_define[, authenticator])</a></td>
|
|
<td class="summary">Creates a button on the top flow which will toggle the given element define, the define must exist in the left flow</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#draw_left_flow">draw_left_flow(player)</a></td>
|
|
<td class="summary">Draw all the left elements onto the left flow, internal use only with on join</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#update_left_flow">update_left_flow(player)</a></td>
|
|
<td class="summary">Update the visible state of the hide button, can be used to check if any frames are visible</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#hide_left_flow">hide_left_flow(player)</a></td>
|
|
<td class="summary">Hides all left elements for a player</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_left_element">get_left_element(player, element_define)</a></td>
|
|
<td class="summary">Get the element define that is in the left flow, use in events without an element refrence</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toggle_left_element">toggle_left_element(player, element_define[, state])</a></td>
|
|
<td class="summary">Toggles the visible state of a left element for a given player, can be used to set the visible state</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Element_Define">Element Define </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#element">element(element_define)</a></td>
|
|
<td class="summary">Used to define new elements for your gui, can be used like LuaGuiElement.add or a custom function</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element:style">Gui._prototype_element:style(style_define)</a></td>
|
|
<td class="summary">Used to extent your element define with a style factory, this style will be applied to your element when created, can also be a custom function</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element:on_custom_event">Gui._prototype_element:on_custom_event(event_name, handler)</a></td>
|
|
<td class="summary">Set the handler which will be called for a custom event, only one handler can be used per event per element</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element:raise_custom_event">Gui._prototype_element:raise_custom_event(event)</a></td>
|
|
<td class="summary">Raise the handler which is attached to an event; external use should be limited to custom events</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Element_Events">Element Events </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_open">Gui._prototype_element.on_open</a></td>
|
|
<td class="summary">Called when the player opens a GUI.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_close">Gui._prototype_element.on_close</a></td>
|
|
<td class="summary">Called when the player closes the GUI they have open.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_click">Gui._prototype_element.on_click</a></td>
|
|
<td class="summary">Called when LuaGuiElement is clicked.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_confirmed">Gui._prototype_element.on_confirmed</a></td>
|
|
<td class="summary">Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_checked_changed">Gui._prototype_element.on_checked_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_elem_changed">Gui._prototype_element.on_elem_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement element value is changed (related to choose element buttons).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_location_changed">Gui._prototype_element.on_location_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement element location is changed (related to frames in player.gui.screen).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_tab_changed">Gui._prototype_element.on_tab_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement selected tab is changed (related to tabbed-panes).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_selection_changed">Gui._prototype_element.on_selection_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_switch_changed">Gui._prototype_element.on_switch_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement switch state is changed (related to switches).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_text_changed">Gui._prototype_element.on_text_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement text is changed by the player.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element.on_value_changed">Gui._prototype_element.on_value_changed</a></td>
|
|
<td class="summary">Called when LuaGuiElement slider value is changed (related to the slider element).</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Top_Flow">Top Flow </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#top_elements">top_elements</a></td>
|
|
<td class="summary">Contains the uids of the elements that will shown on the top flow and their auth functions</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#top_flow_button_style">top_flow_button_style</a></td>
|
|
<td class="summary">The style that should be used for buttons on the top flow</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#top_flow_button_visible_style">top_flow_button_visible_style</a></td>
|
|
<td class="summary">The style that should be used for buttons on the top flow when their flow is visible</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_top_flow">get_top_flow(player)</a></td>
|
|
<td class="summary">Gets the flow refered to as the top flow, each player has one top flow</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Gui._prototype_element:add_to_top_flow">Gui._prototype_element:add_to_top_flow([authenticator])</a></td>
|
|
<td class="summary">Sets an element define to be drawn to the top flow when a player joins, includes optional authenticator</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#update_top_flow">update_top_flow(player)</a></td>
|
|
<td class="summary">Updates the visible state of all the elements on the players top flow, uses authenticator</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toggle_top_flow">toggle_top_flow(player[, state])</a></td>
|
|
<td class="summary">Toggles the visible state of all the elements on a players top flow, effects all elements</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_top_element">get_top_element(player, element_define)</a></td>
|
|
<td class="summary">Get the element define that is in the top flow, use in events without an element refrence</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toolbar_button">toolbar_button(sprite, tooltip[, authenticator])</a></td>
|
|
<td class="summary">Creates a button on the top flow with consistent styling</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#toolbar_button_style">toolbar_button_style(button, state)</a></td>
|
|
<td class="summary">Styles a top flow button depending on the state given</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<!-- module section list end -->
|
|
|
|
<br />
|
|
|
|
<!-- section start -->
|
|
<h3><span id="Dependencies" class="section-title"><a href="#Dependencies">Dependencies</a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#utils.event" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="utils.event">utils.event</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#mod-gui" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="mod-gui">mod-gui</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Tables" class="section-title"><a href="#Tables">Tables</a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#events" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="events">events</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">String indexed table used to avoid conflict with custom event names, similar to how defines.events works</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#defines" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="defines">defines</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Uid indexed array that stores all the factory functions that were defined, no new values will be added during runtime</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#core_defines" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="core_defines">core_defines</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">An string indexed table of all the defines which are used by the core of the gui system, used for internal refrence</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#file_paths" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="file_paths">file_paths</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to store the file names where elements were defined, this can be useful to find the uid of an element, mostly for debuging</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#debug_info" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="debug_info">debug_info</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to store extra infomation about elements as they get defined such as the params used and event handlers registered to them</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#_prototype_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="_prototype_element">_prototype_element</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">The prototype used to store the functions of an element define</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#_mt_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="_mt_element">_mt_element</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">The prototype metatable applied to new element defines</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Fields:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>__call</em></strong>
|
|
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Fields" class="section-title"><a href="#Fields">Fields</a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#uid" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="uid">uid</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">The current highest uid that is being used by a define, will not increase during runtime</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Core_Defines" class="section-title"><a href="#Core_Defines">Core Defines </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#hide_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="hide_top_flow">hide_top_flow</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Button which toggles the top flow elements, version which shows inside the top flow when top flow is visible</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#show_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="show_top_flow">show_top_flow</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Button which toggles the top flow elements, version which shows inside the left flow when top flow is hidden</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#hide_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="hide_left_flow">hide_left_flow</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Button which hides the elements in the left flow, shows inside the left flow when frames are visible</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Defines" class="section-title"><a href="#Defines">Defines </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#alignment" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="alignment">alignment</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Draw a flow used to align its child elements, default is right align</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the alignment will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the alignment flow which is added
|
|
|
|
(<em>default</em>: 'alignment')
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>horizontal_align</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the horizontal alignment of the elements in the flow
|
|
|
|
(<em>default</em>: 'right')
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>vertical_align</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the vertical alignment of the elements in the flow
|
|
|
|
(<em>default</em>: 'center')
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a right align flow
|
|
</span><span class="keyword">local</span> alignment = Gui.alignment(element, <span class="string">'example_right_alignment'</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a horizontal center and top align flow
|
|
</span><span class="keyword">local</span> alignment = Gui.alignment(element, <span class="string">'example_center_top_alignment'</span>, <span class="string">'center'</span>, <span class="string">'top'</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#scroll_table" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="scroll_table">scroll_table</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Draw a scroll pane that has a table inside of it</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the scroll table will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>height</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the maximum height for the scroll pane
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>column_count</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the number of columns that the table will have
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the scroll pane that is added, the table is always called "table"
|
|
|
|
(<em>default</em>: 'scroll')
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a scroll table with max height of 200 and column count of 3
|
|
</span><span class="keyword">local</span> scroll_table = Gui.scroll_table(element, <span class="number">200</span>, <span class="number">3</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#header" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="header">header</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to add a frame with the header style, has the option for a right alignment flow for buttons</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the header will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>caption</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the caption that will be shown on the header
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that will be shown on the header
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>add_alignment</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true an alignment flow will be added to the header
|
|
|
|
(<em>default</em>: false)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the header that is being added, the alignment is always called "alignment"
|
|
|
|
(<em>default</em>: 'header')
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a custom header with a label
|
|
</span><span class="keyword">local</span> header = Gui.header(
|
|
element,
|
|
<span class="string">'Example Caption'</span>,
|
|
<span class="string">'Example Tooltip'</span>
|
|
)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#footer" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="footer">footer</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to add a frame with the footer style, has the option for a right alignment flow for buttons</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the footer will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>caption</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the caption that will be shown on the footer
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that will be shown on the footer
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>add_alignment</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true an alignment flow will be added to the footer
|
|
|
|
(<em>default</em>: false)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the footer that is being added, the alignment is always called "alignment"
|
|
|
|
(<em>default</em>: 'footer')
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a custom footer with a label
|
|
</span><span class="keyword">local</span> footer = Gui.footer(
|
|
element,
|
|
<span class="string">'Example Caption'</span>,
|
|
<span class="string">'Example Tooltip'</span>
|
|
)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#container" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="container">container</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used for left frames to give them a nice boarder</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the container will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name that you want to give to the outer frame, often just event_trigger
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>width</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the minimal width that the frame will have
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a container as a base
|
|
</span><span class="keyword">local</span> container = Gui.container(parent, <span class="string">'my_container'</span>, <span class="number">200</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#bar" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="bar">bar</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to make a solid white bar in a gui</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the bar will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>width</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the width of the bar that will be made, if not given bar will strech to fill the parent
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a bar to a gui
|
|
</span><span class="keyword">local</span> bar = Gui.bar(parent, <span class="number">100</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#centered_label" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="centered_label">centered_label</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to make a label which is centered and of a certian size</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the label will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>width</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the width of the label, must be given in order to center the caption
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>caption</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the caption that will be shown on the label
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that will be shown on the label
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a centered label
|
|
</span><span class="keyword">local</span> label = Gui.centered_label(parent, <span class="number">100</span>, <span class="string">'This is centered'</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#title_label" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="title_label">title_label</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to make a title which has two bars on either side</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Properties / Events:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>parent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the parent element to which the label will be added
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>width</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the width of the first bar, this can be used to position the label
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>caption</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the caption that will be shown on the label
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that will be shown on the label
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a centered label
|
|
</span><span class="keyword">local</span> label = Gui.centered_label(parent, <span class="number">100</span>, <span class="string">'This is centered'</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Helper_Functions" class="section-title"><a href="#Helper_Functions">Helper Functions </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#get_player_from_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_player_from_element">get_player_from_element(element)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Get the player that owns a gui element</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the element to get the owner of
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
<span class="return-text">the player that owns this element</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Geting the owner of an element
|
|
</span><span class="keyword">local</span> player = Gui.get_player_from_element(element)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toggle_enabled_state" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toggle_enabled_state">toggle_enabled_state(element[, state])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Will toggle the enabled state of an element or set it to the one given</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the element to toggle/set the enabled state of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
with given will set the state, else state will be toggled
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">the new enabled state that the element has</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Toggling the the enabled state
|
|
</span><span class="keyword">local</span> new_enabled_state = Gui.toggle_enabled_state(element)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toggle_visible_state" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toggle_visible_state">toggle_visible_state(element[, state])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Will toggle the visible state of an element or set it to the one given</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the element to toggle/set the visible state of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
with given will set the state, else state will be toggled
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">the new visible state that the element has</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Toggling the the visible state
|
|
</span><span class="keyword">local</span> new_visible_state = Gui.toggle_visible_state(element)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#destroy_if_valid" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="destroy_if_valid">destroy_if_valid(element)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Destory a gui element without causing any errors, often because the element was already removed</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the element that you want to remove
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the element was valid and has been removed</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Remove a child element if it exists
|
|
</span>Gui.destroy_if_valid(element[child_name])</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#sprite_style" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="sprite_style">sprite_style(size[, padding=-2][, style])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Returns a table to be used as the style for a sprite buttons, produces a sqaure button</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>size</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the size that you want the button to be
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>padding</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the padding that you want on the sprite
|
|
|
|
(<em>default</em>: -2)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>style</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
any extra style settings that you want to have
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the style table to be used with element_define:style()</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding a sprite button with size 20
|
|
</span><span class="keyword">local</span> button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'sprite-button'</span>,
|
|
sprite = <span class="string">'entity/inserter'</span>
|
|
}
|
|
:style(Gui.sprite_style(<span class="number">20</span>))</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Left_Flow" class="section-title"><a href="#Left_Flow">Left Flow </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#left_elements" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="left_elements">left_elements</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Contains the uids of the elements that will shown on the left flow and their join functions</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#get_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_left_flow">get_left_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gets the flow refered to as the left flow, each player has one left flow</p>
|
|
<p class="section-item-description">(player)</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to get the left flow for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
<span class="return-text">the left element flow</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Geting your left flow
|
|
</span><span class="keyword">local</span> left_flow = Gui.get_left_flow(game.player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element:add_to_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element:add_to_left_flow">Gui._prototype_element:add_to_left_flow([open_on_join])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets an element define to be drawn to the left flow when a player joins, includes optional check</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>open_on_join</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a> or <a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
called during first darw to decide if the element should be visible
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the new element define that is used to register events to this element</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding the example button
|
|
</span>example_flow_with_button:add_to_left_flow(<span class="keyword">true</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#left_toolbar_button" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="left_toolbar_button">left_toolbar_button(sprite, tooltip, element_define[, authenticator])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Creates a button on the top flow which will toggle the given element define, the define must exist in the left flow</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>sprite</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the sprite that you want to use on the button
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that you want the button to have
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the element define that you want to have toggled by this button, define must exist on the left flow
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>authenticator</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
used to decide if the button should be visible to a player
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Add a button to toggle a left element
|
|
</span><span class="keyword">local</span> toolbar_button =
|
|
Gui.left_toolbar_button(<span class="string">'entity/inserter'</span>, <span class="string">'Nothing to see here'</span>, example_flow_with_button, <span class="keyword">function</span>(player)
|
|
<span class="keyword">return</span> player.admin
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#draw_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="draw_left_flow">draw_left_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Draw all the left elements onto the left flow, internal use only with on join</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to draw the elements for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Draw all the left elements
|
|
</span>Gui.draw_left_flow(player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#update_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="update_left_flow">update_left_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Update the visible state of the hide button, can be used to check if any frames are visible</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to update the left flow for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if any left element is visible</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Check if any left elements are visible
|
|
</span><span class="keyword">local</span> visible = Gui.update_left_flow(player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#hide_left_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="hide_left_flow">hide_left_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Hides all left elements for a player</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to hide the elements for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Hide your left elements
|
|
</span>Gui.hide_left_flow(game.player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#get_left_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_left_element">get_left_element(player, element_define)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Get the element define that is in the left flow, use in events without an element refrence</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to get the element for
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the element that you want to get
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
<span class="return-text">the gui element linked to this define for this player</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Get your left element
|
|
</span><span class="keyword">local</span> frame = Gui.get_left_element(game.player, example_flow_with_button)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toggle_left_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toggle_left_element">toggle_left_element(player, element_define[, state])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Toggles the visible state of a left element for a given player, can be used to set the visible state</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to toggle the element for
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the element that you want to toggle
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
with given will set the state, else state will be toggled
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">the new visible state of the element</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Toggle your example button
|
|
</span>Gui.toggle_top_flow(game.player, example_flow_with_button)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Show your example button
|
|
</span>Gui.toggle_top_flow(game.player, example_flow_with_button, <span class="keyword">true</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Element_Define" class="section-title"><a href="#Element_Define">Element Define </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="element">element(element_define)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to define new elements for your gui, can be used like LuaGuiElement.add or a custom function</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a> or <a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the define information for the gui element, same data as LuaGuiElement.add, or a custom function may be used
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the new element define, this can be considered a factory for the element which can be called to draw the element to any other element</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Using element defines like LuaGuiElement.add
|
|
</span><span class="comment">-- This returns a factory function to draw a button with the caption "Example Button"
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>
|
|
}</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Using element defines with a custom factory function
|
|
</span><span class="comment">-- This method can be used if you still want to be able register event handlers but it is too complex to be compatible with LuaGuiElement.add
|
|
</span><span class="keyword">local</span> example_flow_with_button =
|
|
Gui.element(<span class="keyword">function</span>(event_trigger, parent, ...)
|
|
<span class="comment">-- ... shows that all other arguments from the factory call are passed to this function
|
|
</span> <span class="comment">-- parent is the element which was passed to the factory function where you should add your new element
|
|
</span> <span class="comment">-- here we are adding a flow which we will then later add a button to
|
|
</span> <span class="keyword">local</span> flow =
|
|
parent.add{
|
|
name = <span class="string">'example_flow'</span>,
|
|
<span class="global">type</span> = <span class="string">'flow'</span>
|
|
}
|
|
|
|
<span class="comment">-- event_trigger should be the name of any elements you want to trigger your event handlers, such as on_click or on_state_changed
|
|
</span> <span class="comment">-- now we add the button to the flow that we created earlier
|
|
</span> <span class="keyword">local</span> element =
|
|
flow.add{
|
|
name = event_trigger,
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>
|
|
}
|
|
|
|
<span class="comment">-- you must return your new element, this is so styles can be applied and returned to the caller
|
|
</span> <span class="comment">-- you may return any of your elements that you add, consider the context in which it will be used for what should be returned
|
|
</span> <span class="keyword">return</span> element
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element:style" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element:style">Gui._prototype_element:style(style_define)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to extent your element define with a style factory, this style will be applied to your element when created, can also be a custom function</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>style_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a> or <a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
style table where each key and value pair is treated like LuaGuiElement.style[key] = value, a custom function can be used
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the element define is returned to allow for event handlers to be registered</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Using the table method of setting the style
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>,
|
|
style = <span class="string">'forward_button'</span> <span class="comment">-- factorio styles can be applied here
|
|
</span>}
|
|
:style{
|
|
height = <span class="number">25</span>, <span class="comment">-- same as element.style.height = 25
|
|
</span> width = <span class="number">100</span> <span class="comment">-- same as element.style.width = 25
|
|
</span>}</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Using the function method to set the style
|
|
</span><span class="comment">-- Use this method if your style is dynamic and depends on other factors
|
|
</span><span class="keyword">local</span> example_button =
|
|
Gui.element{
|
|
<span class="global">type</span> = <span class="string">'button'</span>,
|
|
caption = <span class="string">'Example Button'</span>,
|
|
style = <span class="string">'forward_button'</span> <span class="comment">-- factorio styles can be applied here
|
|
</span>}
|
|
:style(<span class="keyword">function</span>(style, element, ...)
|
|
<span class="comment">-- style is the current style object for the elemenent
|
|
</span> <span class="comment">-- element is the element that is being changed
|
|
</span> <span class="comment">-- ... shows that all other arguments from the factory call are passed to this function
|
|
</span> <span class="keyword">local</span> player = game.players[element.player_index]
|
|
style.height = <span class="number">25</span>
|
|
style.width = <span class="number">100</span>
|
|
style.font_color = player.color
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element:on_custom_event" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element:on_custom_event">Gui._prototype_element:on_custom_event(event_name, handler)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Set the handler which will be called for a custom event, only one handler can be used per event per element</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the event you want to handler to be called on, often from Gui.events
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the handler that you want to be called when the event is raised
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the element define so more handleres can be registered</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Register a handler to "my_custom_event" for this element
|
|
</span>element_deinfe:on_custom_event(<span class="string">'my_custom_event'</span>, <span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(player.name)
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element:raise_custom_event" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element:raise_custom_event">Gui._prototype_element:raise_custom_event(event)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Raise the handler which is attached to an event; external use should be limited to custom events</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the event table passed to the handler, must contain fields: name, element
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the element define so more events can be raised</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> Raising a custom event
|
|
element_define:raise_custom_event{
|
|
name = <span class="string">'my_custom_event'</span>,
|
|
element = element
|
|
}</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Element_Events" class="section-title"><a href="#Element_Events">Element Events </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_open" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_open">Gui._prototype_element.on_open</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when the player opens a GUI.</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_open(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_close" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_close">Gui._prototype_element.on_close</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when the player closes the GUI they have open.</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_close(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_click" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_click">Gui._prototype_element.on_click</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement is clicked.</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_click(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_confirmed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_confirmed">Gui._prototype_element.on_confirmed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield.</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_confirmed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_checked_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_checked_changed">Gui._prototype_element.on_checked_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_checked_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_elem_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_elem_changed">Gui._prototype_element.on_elem_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement element value is changed (related to choose element buttons).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_elem_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_location_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_location_changed">Gui._prototype_element.on_location_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement element location is changed (related to frames in player.gui.screen).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_location_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_tab_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_tab_changed">Gui._prototype_element.on_tab_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement selected tab is changed (related to tabbed-panes).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_tab_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_selection_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_selection_changed">Gui._prototype_element.on_selection_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_selection_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_switch_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_switch_changed">Gui._prototype_element.on_switch_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement switch state is changed (related to switches).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_switch_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_text_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_text_changed">Gui._prototype_element.on_text_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement text is changed by the player.</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_text_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element.on_value_changed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element.on_value_changed">Gui._prototype_element.on_value_changed</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Called when LuaGuiElement slider value is changed (related to the slider element).</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-module-field-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the event handler which will be called
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code> element_define:on_value_changed(<span class="keyword">function</span>(event)
|
|
event.player.<span class="global">print</span>(<span class="global">table</span>.inspect(event))
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Top_Flow" class="section-title"><a href="#Top_Flow">Top Flow </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#top_elements" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="top_elements">top_elements</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Contains the uids of the elements that will shown on the top flow and their auth functions</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#top_flow_button_style" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="top_flow_button_style">top_flow_button_style</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">The style that should be used for buttons on the top flow</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#top_flow_button_visible_style" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="top_flow_button_visible_style">top_flow_button_visible_style</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">The style that should be used for buttons on the top flow when their flow is visible</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#get_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_top_flow">get_top_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gets the flow refered to as the top flow, each player has one top flow</p>
|
|
<p class="section-item-description">(player)</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to get the flow for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
<span class="return-text">the top element flow</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Geting your top flow
|
|
</span><span class="keyword">local</span> top_flow = Gui.get_top_flow(game.player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Gui._prototype_element:add_to_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Gui._prototype_element:add_to_top_flow">Gui._prototype_element:add_to_top_flow([authenticator])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets an element define to be drawn to the top flow when a player joins, includes optional authenticator</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>authenticator</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
called during toggle or update to decide weather the element should be visible
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">the new element define to allow event handlers to be registered</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Adding an element to the top flow on join
|
|
</span>example_button:add_to_top_flow(<span class="keyword">function</span>(player)
|
|
<span class="comment">-- example button will only be shown if the player is an admin
|
|
</span> <span class="comment">-- note button will not update its state when player.admin is changed Gui.update_top_flow must be called for this
|
|
</span> <span class="keyword">return</span> player.admin
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#update_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="update_top_flow">update_top_flow(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Updates the visible state of all the elements on the players top flow, uses authenticator</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to update the top flow for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Update your top flow
|
|
</span>Gui.update_top_flow(game.player)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toggle_top_flow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toggle_top_flow">toggle_top_flow(player[, state])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Toggles the visible state of all the elements on a players top flow, effects all elements</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to toggle the top flow for
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
if given then the state will be set to this
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">the new visible state of the top flow</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Toggle your flow
|
|
</span>Gui.toggle_top_flow(game.player)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Open your top flow
|
|
</span>Gui.toggle_top_flow(game.player, <span class="keyword">true</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#get_top_element" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_top_element">get_top_element(player, element_define)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Get the element define that is in the top flow, use in events without an element refrence</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that you want to get the element for
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>element_define</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the element that you want to get
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
<span class="return-text">the gui element linked to this define for this player</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Get your top element
|
|
</span><span class="keyword">local</span> button = Gui.get_top_element(game.player, example_button)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toolbar_button" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toolbar_button">toolbar_button(sprite, tooltip[, authenticator])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Creates a button on the top flow with consistent styling</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>sprite</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the sprite that you want to use on the button
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tooltip</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="http://lua-api.factorio.com/latest/Concepts.html#LocalizedString">LocalizedString</a></span>)
|
|
|
|
the tooltip that you want the button to have
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>authenticator</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
used to decide if the button should be visible to a player
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Add a button to the toolbar
|
|
</span><span class="keyword">local</span> toolbar_button =
|
|
Gui.left_toolbar_button(<span class="string">'entity/inserter'</span>, <span class="string">'Nothing to see here'</span>, <span class="keyword">function</span>(player)
|
|
<span class="keyword">return</span> player.admin
|
|
<span class="keyword">end</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#toolbar_button_style" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="toolbar_button_style">toolbar_button_style(button, state)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Styles a top flow button depending on the state given</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>button</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaGuiElement.html">LuaGuiElement</a></span>)
|
|
|
|
the button element to style
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
The state the button is in
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<strong>Usage:</strong>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Sets the button to the visible style
|
|
</span>Gui.toolbar_button_style(button, <span class="keyword">true</span>)</code></pre>
|
|
<pre class="code" data-lang="Lua"><code><span class="comment">-- Sets the button to the hidden style
|
|
</span>Gui.toolbar_button_style(button, <span class="keyword">false</span>)</code></pre>
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<!-- section end -->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer container grid-1280">
|
|
<div class="divider divider-custom"></div>
|
|
<div class="footer-columns columns">
|
|
<div class="sidebar-footer column col-3 col-sm-12">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
|
|
</div>
|
|
<div class="content-footer column col-9 col-sm-12">
|
|
<i>Last updated 2021-12-29 15:59:20 UTC</i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|