eg-overlay#
local overlay = require 'eg-overlay'
The eg-overlay
module contains core functions that other modules use
to communicate with the overlay.
Functions#
- eg-overlay.addeventhandler(event, handler)#
Add an event handler for the given event name.
The handler function will be called every time that particular event is posted with two arguments: the event name and event data. The may be
nil
, any Lua data type or ajansson.json
object.- Parameters:
- Returns:
A callback ID that can be used with
removeeventhandler()
.- Return type:
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from add_event_handler to addeventhandler
- eg-overlay.removeeventhandler(event, cbi)#
Remove an event handler for the given event name. The callback ID is returned by
addeventhandler()
.Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from remove_event_handler to removeeventhandler
- eg-overlay.queueevent(event, data)#
Add a new event to the queue.
- Parameters:
event (
string
) – Event typedata – Optional event data
- Returns:
none
Note
Events are dispatched in the order they are queued each render frame. Events that are queued during an event callback will be dispatched on the following frame.
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from queue_event to queueevent
- eg-overlay.time()#
Returns the fractional number of seconds since the overlay was started. This can be used to time animations, events, etc.
- Returns:
Time value
- Return type:
Version History
Version
Notes
0.0.1
Added
- eg-overlay.settings()#
Returns a
settings
object for the overlay itself, which holds core settings and defaults.- Return type:
Version History
Version
Notes
0.0.1
Added
- eg-overlay.memusage()#
Returns a table containing the memory usage of the overlay. These statistics are for the application as a whole, and not just Lua.
- Returns:
Memory usage
- Return type:
Field
Description
working_set
The current memory in use by the overlay, in bytes.
peak_working_set
The maximum amount of memory the overlay has used
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from mem_usage to memusage
- eg-overlay.videomemusage()#
Returns the video memory usage of the overlay, in bytes.
- Returns:
Video memory usage
- Return type:
Version History
Version
Notes
0.1.0
Added
- eg-overlay.processtime()#
Returns a table containing the CPU time and uptime of the overlay. This can be used to calculate the overlay’s CPU usage.
- Returns:
Process time
- Return type:
Field
Description
process_time_total
The total time the overlay has been running.
user_time
The total time spent executing code within the overlay.
kernel_time
The total time spent executing system code for the overlay, not including idle time.
system_user_time
The total time spent executing all application code on the system.
system_kernel_time
The total time spent executing system code on the system, including idle time.
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from process_time to processtime
- eg-overlay.datafolder(name)#
Returns the full path to the data folder for the given module.
Modules should store any data other than settings in this folder. The folder will be created by this function if it does not already exist.
- Parameters:
name (
string
) – The name of the module and corresponding folder.- Returns:
The full path to the module data folder.
- Return type:
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from data_folder to datafolder
- eg-overlay.clipboardtext([text])#
Set or return the text on the clipboard.
- Parameters:
text (
string
) – (Optional) If present, the text to set the clipboard to.- Returns:
If
text
isnil
, returns the text currently on the clipboard. Otherwisenil
.- Return type:
Version History
Version
Notes
0.0.1
Added
0.1.0
Renamed from clipboard_text to clipboardtext
- eg-overlay.exit()#
Exit EG-Overlay.
Danger
This will unconditionally and immediately cause the overlay to shutdown. Most modules will not use this function.
Version History
Version
Notes
0.0.1
Added
- eg-overlay.findfiles(path)#
Return a sequence containing the files and directories matching
path
.path
can contain wildcards.Each file returned will be a table with the following fields:
Field
Description
name
File/directory name.
type
'directory'
or'file'
.hidden
true
orfalse
.system
true
orfalse
.readonly
true
orfalse
.Version History
Version
Notes
0.1.0
Added
- eg-overlay.uuid()#
Return a new Universally Unique Identifier (UUID).
The returned UUID is a string in ‘8-4-4-12’ format.
- Return type:
Version History
Version
Notes
0.1.0
Added
- eg-overlay.uuidtobase64(uuid)#
Convert a UUID from an ‘8-4-4-12’ format string to a BASE64 encoded string.
Version History
Version
Notes
0.1.0
Added
- eg-overlay.uuidfrombase64(base64uuid)#
Convert a UUID from a BASE64 encoded string to an ‘8-4-4-12’ format string.
Version History
Version
Notes
0.1.0
Added
- eg-overlay.currentdirectory()#
Return the current working directory as a string.
- Return type:
Version History
Version
Notes
0.1.0
Added