XmlLoadFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
xmlnode xmlLoadFile ( string filename, resource root = getThisResource () )            
xmlnode xmlLoadFile ( string filename, [ resource fromResource = getThisResource () ] )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''filename:''' The path to the file you wish to load.  This is a path relative to the current or specified resource root directory.
*'''filename:''' the path to the file you wish to load.  This is a path relative to the current or specified resource root directory.
 
===Optional Arguments===
{{OptionalArg}}
*'''fromResource:''' the [[resource]] whose directory will be used as the root for the filename specified.
 
===Returns===
Returns the root [[xmlnode]] object of an xml file if successful, or ''false'' otherwise.
</section>
</section>
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 20: Line 28:
===Required Arguments===  
===Required Arguments===  
*'''filename:''' The path to the file you wish to load.  This is a path relative to the '''"mods\deathmatch" folder found in your MTA San Andreas installation directory.'''.
*'''filename:''' The path to the file you wish to load.  This is a path relative to the '''"mods\deathmatch" folder found in your MTA San Andreas installation directory.'''.
</section>


===Returns===
===Returns===
Returns the root [[xmlnode]] object of an xml file if successful, or ''false'' otherwise.
Returns the root [[xmlnode]] object of an xml file if successful, or ''false'' otherwise.
</section>


==Example==  
==Example==  

Revision as of 01:13, 21 October 2007

This function provides an alternative way to load XML files to getResourceConfig. This function loads an XML file and returns the node by specifying a specific file path, while getResourceConfig allows for loading an XML file from a resource.

Syntax

Click to collapse [-]
Server
xmlnode xmlLoadFile ( string filename, [ resource fromResource = getThisResource () ] )

Required Arguments

  • filename: the path to the file you wish to load. This is a path relative to the current or specified resource root directory.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • fromResource: the resource whose directory will be used as the root for the filename specified.

Returns

Returns the root xmlnode object of an xml file if successful, or false otherwise.

Click to collapse [-]
Client
xmlnode xmlLoadFile ( string filename )              

Required Arguments

  • filename: The path to the file you wish to load. This is a path relative to the "mods\deathmatch" folder found in your MTA San Andreas installation directory..

Returns

Returns the root xmlnode object of an xml file if successful, or false otherwise.

Example

This example loads an XML file called test.xml.

node = xmlLoadFile ( "test.xml" )

See Also