I feel like such a noob Thanks!thelinx wrote:table.getn (which is deprecated, use #myTable) only counts the sequence part of the table. (The part that's indexed by numbers, not keys)
ipairs also only loops through the sequence part. Use pairs(myTable) to loop through all values in the table.
Search found 9 matches
- Mon Dec 05, 2011 5:20 pm
- Forum: Support and Development
- Topic: unintentional change to a table
- Replies: 7
- Views: 5457
Re: unintentional change to a table
- Mon Dec 05, 2011 4:57 pm
- Forum: Support and Development
- Topic: unintentional change to a table
- Replies: 7
- Views: 5457
Re: unintentional change to a table
As I won't need a price field, would it suffice to say: tInventory = { gold = 10; silver = 100 } ? Sure, that is in fact the structure of the "temp" table in my second suggestion. I've tried it out but for some reason the table appears empty... At least according to table.getn. See this c...
- Sun Dec 04, 2011 9:09 pm
- Forum: Support and Development
- Topic: unintentional change to a table
- Replies: 7
- Views: 5457
Re: unintentional change to a table
Thanks a lot guys! I'm new to Lua and I figured that at some point I'd get things confused with other languages. Lua never copies anything. a = b means "a points to whatever b points to", not "the value of b is copied and put in a". Robin: In hindsight I should have seen this com...
- Sun Dec 04, 2011 1:03 pm
- Forum: Support and Development
- Topic: unintentional change to a table
- Replies: 7
- Views: 5457
unintentional change to a table
Hi, I'm trying to do the following thing. I have a table, say set = { { name = "gold", amount = 10 }, { name = "silver", amount = 100 } } Now I wrote a function that can add values to it from a similar set, like such: function addSet(setToBeAdded, s) local setToBeReturned = s for...
- Wed Nov 30, 2011 4:39 pm
- Forum: Libraries and Tools
- Topic: tile based civ builder
- Replies: 10
- Views: 5612
Re: tile based civ builder
Ah, Dwarf Fortress. Oh, Dwarf Fortress. - If the only way to learn how to play your game is by forcing players to read /third-party/, 100+ page manuals, IT IS VERY WRONG AND NEEDS TO BE FIXED IMMEDIATELY. Well, if you're supposed to read through 100+ page manuals to "get it", then it's not...
- Tue Nov 29, 2011 1:59 pm
- Forum: Libraries and Tools
- Topic: tile based civ builder
- Replies: 10
- Views: 5612
Re: tile based civ builder
Well maybe I want to offer the option of tedious micromgmt... for masochists who are into that kind of kinky stuffTaehl wrote:More tedious? Is that supposed to be a good thing?
Good luck with your project, though.
- Tue Nov 29, 2011 12:23 pm
- Forum: Libraries and Tools
- Topic: tile based civ builder
- Replies: 10
- Views: 5612
tile based civ builder
Here's some screenshots of what I'm working on. Basically a civilization clone but intended to have much, much more tedious micro management. It's in alpha alpha alpha mode!
- Mon Nov 07, 2011 10:56 pm
- Forum: Support and Development
- Topic: using draw.graphics.rectangle to draw tiles
- Replies: 3
- Views: 2094
Re: using draw.graphics.rectangle to draw tiles
Thanks for the quick responses! I'll try to render it to an image, see if that works. Here is the function that does the drawing and is the first to be called in the love.draw() handler. (FYI, tileSize = 16, waterLevel = 127, and mapX, mapY denote where the screen is focusing on.) function love.draw...
- Mon Nov 07, 2011 9:06 pm
- Forum: Support and Development
- Topic: using draw.graphics.rectangle to draw tiles
- Replies: 3
- Views: 2094
using draw.graphics.rectangle to draw tiles
Hi. I recently started using Love to shape a longtime dream into reality (agreed that sounds weird). I'm making a 2D, tile-based, turn-based sim/strategy game. Right now I'm at the stage where I'm trying to draw a scrolling 2d map onto the screen. This works well using tilesets and some newSpriteBat...