EngineImageGetFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Changed description)
(Fix API description, add example)
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:


{{New feature/item|4|1.6.0|21695|This function gets a file from an IMG container.}}
{{New feature/item|4|1.6.0|21695|This function gets a file from an IMG container.}}
{{Warning|This article is incomplete and may contain errors}}


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
img engineImageGetFile ( img img_file, string file_name )
string engineImageGetFile ( img img_file, string/number file )
</syntaxhighlight>
</syntaxhighlight>


{{OOP||[[DFF|EngineIMG]]}}
{{OOP||[[img]]:getFile||}}
===Required Arguments===
===Required Arguments===
* '''img_file''': The [[IMG]] file you want to get file from.
* '''img_file''': The [[IMG]] file you want to get file from.
* '''file_name'': Name of the file you want to get.
* '''file''': Name or position of the file you want to get.


===Returns===
===Returns===
Returns file if successfull, false otherwise.
Returns file's binary data if successful, false otherwise. Data size is bonded to 2 Kb block size.
 
==Example==
 
You could use the following code:
<syntaxhighlight lang="lua">
local img = engineLoadIMG( "file.img" )
local data = engineImageGetFile( img, 'test.dff' )
local dff = engineLoadDFF( data )
engineReplaceModel ( dff, 400 )
</syntaxhighlight>
 


==See Also==
==See Also==
{{Engine_functions}}
{{Engine_functions}}

Latest revision as of 19:27, 10 April 2023

ADDED/UPDATED IN VERSION 1.6.0 r21695:
This function gets a file from an IMG container.

Syntax

string engineImageGetFile ( img img_file, string/number file )


OOP Syntax Help! I don't understand this!

Method: img:getFile(...)


Required Arguments

  • img_file: The IMG file you want to get file from.
  • file: Name or position of the file you want to get.

Returns

Returns file's binary data if successful, false otherwise. Data size is bonded to 2 Kb block size.

Example

You could use the following code:

local img = engineLoadIMG( "file.img" )
local data = engineImageGetFile( img, 'test.dff' )
local dff = engineLoadDFF( data )
engineReplaceModel ( dff, 400 )


See Also