Jump to content

getting all resources


toxicsmoke11

Recommended Posts

hello, i am trying to loop through all resources but both methods give ridicilous errors

method one

for _,resources in pairs(getResources()) do 
          local name = getResourceInfo(resources,"name") 
      end 

method one: some error at getResourceInfo

-- attempt to concentrate local 'resources' (a userdata value)

method two:

for _,resources in pairs(getElementsByType("resource")) do 
          local name = getResourceInfo(resources,"name") 
      end 

expected getResourceInfo... expected resource-data got resource -- ??????

Edited by Guest
Link to comment

without name i can't proceed.

i have downloaded a random map and here is meta part of info

"race" type="map" name="[DM] Javelin ft. StyLeX - Skilled Club" author="Javelin & StyLeX" version="1.0.1">

also im having problem with expected resource-data got resource warning which causes me to fail to get resources and their info

Link to comment

turns out that i have forgot this line

if (getResourceInfo(resource,"type") == "map") and (getResourceInfo(resource,"gamemodes") == "race") and getResourceInfo(resource,"name") then 

so if it would find a single resource without that name and map and gamemode thingy, it would abort the script

anyway thanks for help guys

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...