This repository was archived by the owner on Aug 20, 2022. It is now read-only.
-
Couldn't load subscription status.
- Fork 12
JavaScript UI Methods
benank edited this page Aug 19, 2020
·
3 revisions
While in JavaScript land, we have some methods accessible to us that allow us to communicate back to the client in Lua land.
Keep in mind that the JavaScript here must be included in an HTML file that was created using UI:Create. By doing this, we automatically get these nice methods to use.
- Focuses on a certain element. Great for setting focus on inputs, like textboxes.
-
elem(jQuery element): element that you want to focus on
- Calls an event back to the client side in Lua.
- To receive this event in Lua, use
UIInstance:Subscribe. -
event_name(string): event name that you want to call -
data(object or array): data that you want to send with the event
- Subscribes to an event called from Lua.
- To call the corresponding event in Lua, use
UIInstance:CallEvent. -
event_name(string): event name that you want to subscribe to -
callback(function): function that you want to call when the event is triggered