game.addResource
Adds resources (HUDs, additional AIModels, etc.) to the game's resources tab.
Prototype
bOk = game.addResource ( hGame, hFile|(kResourceType, sResourceName) )
Description
The function takes either a combination of resourceType and resourceName, or alternatively a file handle whose type and proper resource name will be determined by ShiVa.
Please check the resource constants for more info.
Parameters
hGame - valid Game handle
hFile - valid file handle OR...
(kResourceType, sResourceName) - pair of predefined type like resource.kTypeXML constant AND resource name string
Return values
bOk - true on success
Sample
function onPropertyViewSectionResourcesProcessDrop ( hView, hGame, hComponent, nPointX, nPointY, tFiles ) -- Accept drop if at least one file is matching local sComponentID = gui.getComponentIdentifier ( hComponent ) local bAtLeastOneFileProcessed = false for i = 1, #tFiles do -- trick here: positive file types are resources :) if ( ( sComponentID == "section.resources.tree" ) and ( project.getFileType ( tFiles[i] ) > 0 ) ) then game.addResource ( hGame, project.getFileType ( tFiles[i] ), project.getFileName ( tFiles[i] ) ) bAtLeastOneFileProcessed = true end end return bAtLeastOneFileProcessed end
Available since ShiVa 2.0