Try the string library: http://lua-users.org/wiki/StringLibraryTutorial
You should be able to get away with using the byte function and iterating through the string.
Hi, I was wandering if there was a command to split all of a string into arrays for my game that uses text files to show the level. It is in the format:
which "0" is blackness, "1" is wooden flooring and "2" is the wall.0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,
0,0,0,0,2,1,1,1,1,1,1,1,1,1,2,
0,0,0,0,2,1,1,1,1,1,1,1,1,1,2,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,
0,0,0,0,2,1,1,1,1,1,1,1,1,1,2,
0,0,0,0,2,2,2,2,2,2,2,2,2,2,2
Try the string library: http://lua-users.org/wiki/StringLibraryTutorial
You should be able to get away with using the byte function and iterating through the string.
trying it now
I was just wondering, why not use a two dimensional array of numbers/integers instead of strings? It be quicker to process and manage.
ah yes, i could put it into another lua file like level1.lua and have it as an array and use dofile() to get it. hmmm..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks