DgsGetProperty: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(DGS (OOP Syntax)/(Template Organization) Mission)
m (DGS OOP Syntax changing)
 
Line 7: Line 7:
string dgsGetProperty ( element dgsElement, string property )
string dgsGetProperty ( element dgsElement, string property )
</syntaxhighlight>
</syntaxhighlight>
{{DGS/OOP||DGSElement:getProperty|||dgsSetProperty}}
{{DGS/OOP|
    Method = DGSElement:getProperty|
    Counterpart = dgsSetProperty
}}


===Required Arguments===
===Required Arguments===

Latest revision as of 19:37, 3 May 2021

This function gets the value of a specific property of a DGS element. For a list of properties and their meaning, see the DGS properties page.

Syntax

string dgsGetProperty ( element dgsElement, string property )

DGS OOP Syntax Help! I don't understand this!

Method: DGSElement:getProperty(...)
Counterpart: dgsSetProperty

Required Arguments

  • dgsElement: the DGS element you wish to get a property of.
  • property: the name of of property you want the value of.

Returns

If the function succeeds, it returns a value of the property. An error will occur if failed.

Example

This example creates a button when the resource starts and defines a console command that toggles it between enabled (clickable) and disabled (not clickable).

DGS = exports.dgs
button = DGS:dgsCreateButton(20, 200, 150, 30, "Test", false)

addCommandHandler("togglebtn",function()
	local currentState = DGS:dgsGetProperty(button, "enabled")
	DGS:dgsSetProperty(button, "enabled", not currentState)
end)

See Also

DGS Properties

General Properties

Unique Properties For DGS Core Elements

Extra Properties For DGS Plugins

General Functions

General Events