DgsGetProperty: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (DGS OOP Syntax changing)
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
string dgsGetProperty ( element dgsElement, string property )
string dgsGetProperty ( element dgsElement, string property )
</syntaxhighlight>
</syntaxhighlight>
{{DGS/OOP|
    Method = DGSElement:getProperty|
    Counterpart = dgsSetProperty
}}


===Required Arguments===
===Required Arguments===
Line 27: Line 31:
</syntaxhighlight>
</syntaxhighlight>


==See Also==
=See Also=
{{DGSFUNCTIONS}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">DGS Properties</span>==
{{DGSPROPERTIES}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>==
{{DGS General Functions}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>==
{{DGS Events/General}}

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