LoadMapData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function is intended to load data from a loaded XML file into the element tree. This could be used for loading an external map, or part of another map.


==Syntax==  
==Syntax==  
Line 10: Line 8:


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''node:''' The node that you wish to load into the [[element tree]].
 
*'''parent:''' The node you wish to be the parent of the new map data.
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns an [[element]] object that corresponds to the root of the new data added, i.e. an element that represents the ''node'' xmlnode passed to the function. Returns ''false'' if the arguments are invalid.


==Example==  
==Example==  
This example does...
This example is a function that you could use to load an arbitary [[map file]] into the [[element tree]].
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function loadMapFile ( filename )
blabhalbalhb --abababa
node = xmlLoadFile ( filename )
--This line does this...
-- Check if the file was loaded ok
mooo
if ( node ) then
-- Load the loaded xml file into the element tree
loadMapData ( node, getRootNode )
-- Unload the xml file again
xmlUnloadFile ( node )
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Map_Functions}}

Revision as of 20:18, 24 May 2006

This function is intended to load data from a loaded XML file into the element tree. This could be used for loading an external map, or part of another map.

Syntax

element loadMapData ( xmlnode node, element parent )  

Required Arguments

  • node: The node that you wish to load into the element tree.
  • parent: The node you wish to be the parent of the new map data.

Returns

Returns an element object that corresponds to the root of the new data added, i.e. an element that represents the node xmlnode passed to the function. Returns false if the arguments are invalid.

Example

This example is a function that you could use to load an arbitary map file into the element tree.

function loadMapFile ( filename )
	node = xmlLoadFile ( filename )
	-- Check if the file was loaded ok
	if ( node ) then
		-- Load the loaded xml file into the element tree
		loadMapData ( node, getRootNode )
		-- Unload the xml file again
		xmlUnloadFile ( node )
	end
end

See Also

Template:Map Functions