toxicsmoke11 Posted January 1, 2015 Share Posted January 1, 2015 (edited) 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 January 1, 2015 by Guest Link to comment
WASSIm. Posted January 1, 2015 Share Posted January 1, 2015 but we don't see variable 'resource' Link to comment
xeon17 Posted January 1, 2015 Share Posted January 1, 2015 function displayResources() local resourceTable = getResources() for resourceKey, resourceValue in ipairs(resourceTable) do local name = getResourceName(resourceValue) end Link to comment
toxicsmoke11 Posted January 1, 2015 Author Share Posted January 1, 2015 wassim please read my looping example again and see better that 'resources' is a table value @XeoN- that's exactly the same thing i did except you used a variable which won't do anything Link to comment
WASSIm. Posted January 1, 2015 Share Posted January 1, 2015 are you kidding me ? its was like that and you'r edit it method one: some error at getResourceInfo -- attempt to concentrate local 'resource' (a userdata value) Last edited by toxicsmoke11 on 01 Jan 2015 02:22, edited 1 time in total. Link to comment
toxicsmoke11 Posted January 1, 2015 Author Share Posted January 1, 2015 can you help me or not Link to comment
Blaawee Posted January 1, 2015 Share Posted January 1, 2015 for _,resources in pairs( getResources( ) ) do local name = getResourceInfo( resources, "name" ) or "" end Maybe some of your resources info Undefined Link to comment
toxicsmoke11 Posted January 1, 2015 Author Share Posted January 1, 2015 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
toxicsmoke11 Posted January 1, 2015 Author Share Posted January 1, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now