forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array? Extraction

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Danny769



Joined: 01 Feb 2006
Posts: 55

PostPosted: Fri Apr 28, 2006 10:40 am    Post subject: Array? Extraction Reply with quote

Ok here it the deal im making an array for a class cits
Cits need (HP,Wood,Food,Gold,Stone,Qunity,X,Y)

Ok now my question is, what is the code to extract a single cell, and to write to a single cell in an array

The Folling Is an Example of my Array

Code:
a, b, c, d, e, f, g, h = 0

Cit = {}

for a = 0, 20 do
  Cit[a] = {}
   for b = 0, 20 do
    Cit[a][b] = {}
    for c = 0, 20 do
      Cit[a][b][c] = {}
       for d = 0, 20 do
        Cit[a][b][c][d] = {}
         for e = 0, 20 do
          Cit[a][b][c][d][e] = {}
           for f = 0, 20 do
            Cit[a][b][c][d][e][f] = {}
             for g = 0, 20 do
              Cit[a][b][c][d][e][f][g] = {}
               for h = 0, 20 do
                Cit[a][b][c][d][e][f][g][h] = {}
           end
          end
         end
        end
       end
      end
    end
  end
Back to top
View user's profile Send private message
Danny769



Joined: 01 Feb 2006
Posts: 55

PostPosted: Fri Apr 28, 2006 11:09 am    Post subject: Reply with quote

http://www.evilmana.com/tutorials/lua_tutorial_05.php

sorry about that but i found what i wanted

Cit = {}
Cit[1] = { HP = DefaultHP, Wood = 1, Gold = 0, Stone = 0, Food = 0, Qunity = 100}
Cit[2] = { HP = DefaultHP, Wood = 1, Gold = 0, Stone = 0, Food = 0, Qunity = 100}
Cit[3] = { HP = DefaultHP, Wood = 1, Gold = 0, Stone = 0, Food = 0, Qunity = 100}

Cit[1].HP = Cit[1].HP - 10

Ok i get it now Sorry about that
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group