EngineImageGetFiles: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|4|1.6.0|21695|This function gets the files from an IMG container.}} {{Warning|This article is incomplete and may contain errors}} ==Syntax== <syntaxhighlight lang="lua"> img engineImageGetFiles ( img img_file ) </syntaxhighlight> {{OOP||EngineIMG}} ===Required Arguments=== * '''img_file''': The IMG file you want to get files from. ===Returns=== Returns files in the IMG element if successfull, false othe...")
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
{{Client function}}
{{Client function}}


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


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
img engineImageGetFiles ( img img_file )
table engineImageGetFiles ( img imgArchive )
</syntaxhighlight>
</syntaxhighlight>


{{OOP||[[DFF|EngineIMG]]}}
{{OOP||[[img]]:getFiles|files}}
===Required Arguments===
===Required Arguments===
* '''img_file''': The [[IMG]] file you want to get files from.
* '''imgArchive''': The [[IMG]] file handler you want to get files from.


===Returns===
===Returns===
Returns files in the [[IMG]] element if successfull, false otherwise.
Returns array table with files in the [[IMG]] element if successfull, false otherwise.
 
==Example==
 
You could use the following code:
<syntaxhighlight lang="lua">
local img = engineLoadIMG( "file.img" )
local filesInArchive = engineImageGetFiles( img )
 
outputChatBox("'file.img' contains files:")
for fileId = 1, #filesInArchive do
    outputChatBox(fileId .. ": " .. filesInArchive[i])
end
</syntaxhighlight>
 


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

Latest revision as of 19:39, 10 April 2023

ADDED/UPDATED IN VERSION 1.6.0 r21695:
This function gets the list of files from an IMG container.

Syntax

table engineImageGetFiles ( img imgArchive )


OOP Syntax Help! I don't understand this!

Method: img:getFiles(...)
Variable: .files


Required Arguments

  • imgArchive: The IMG file handler you want to get files from.

Returns

Returns array table with files in the IMG element if successfull, false otherwise.

Example

You could use the following code:

local img = engineLoadIMG( "file.img" )
local filesInArchive = engineImageGetFiles( img )

outputChatBox("'file.img' contains files:")
for fileId = 1, #filesInArchive do
    outputChatBox(fileId .. ": " .. filesInArchive[i])
end


See Also