GetResources: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
     outputConsole("List of resources:")
     outputConsole("List of resources:")
     local resourceTable = getResources() -- get a table of resources
     local resourceTable = getResources() -- get a table of resources
     for resourceKey, resourceValue in resourceTable do
     for resourceKey, resourceValue in ipairs(resourceTable) do
           -- iterate through the table and output each resource's name
           -- iterate through the table and output each resource's name
           local name = getResourceName(resourceValue)
           local name = getResourceName(resourceValue)

Revision as of 22:18, 6 May 2007

This function retrieves a table of all the resources that exist on the server.

Syntax

table getResources ()

Returns

Returns a table of resources.

Example

function displayResources()
     outputConsole("List of resources:")
     local resourceTable = getResources() -- get a table of resources
     for resourceKey, resourceValue in ipairs(resourceTable) do
          -- iterate through the table and output each resource's name
          local name = getResourceName(resourceValue)
          outputConsole(" " .. name)
     end
end

See Also