Length command not working
i have a list named map that contains [ [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#]
] Then I did Map[1].length And it worked for a little then broke
i have a list named map that contains [ [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#] [#,#,#,#,#]
] Then I did Map[1].length And it worked for a little then broke
it could be that the list is named "map" and then typed "Map[1].length". make sure both are typed identically, capitalization matters
it's hard to tell what the issue could be in this scenario with such little information. if you can, please post some of the code here to get more info on how to help
Accts is most likely right because I just recreated your code and had no error.
here’s my full code: init = function() map = [] py = 0 px = 0
generate = function() for y = 1 to 1000 map.push([]) for x = 1 to 20 map[y].push("#") end end end
render = function() for y = 1 to map.length print(map[y]) end end end
update = function() render() system.prompt(message,callback) end
draw = function() end
I’m trying to make a map generator
the console printing is temporary but I still need the loop functional
if you don't have something in the map list, it wont do anything. if you're trying to access map sprites, you need to use listName.maps["mapName","maptwo","etc"] there's also no call for the function generate in update, and will never get used
these are just the things I noticed, as I'm not too used to for functions and don't use maps often
There is a built-in tilemap feature, and you can modify tilemaps via code. They can be created in the Maps tab and are stored in the global maps
object.
I figured it out thanks for your help