iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Closed TopicStart new topic
> [solved]The hash table, Now solved.
Faalhaasje
post Mar 1 2012, 09:25 AM
Post #1


Dutchman
Group Icon


Type: Coder
Alignment: Chaotic Good




Hello all,

To start off, I am a very, very big noob in scripting. I am trying to learn it as best as I can, and this is the first time I tried my hands on hash tables [I think it's called like that]

so here's my code:
CODE
module HashTable
  array = {}
  array = {
  1 => 'blabla'
  2 => 'yourmom'
  }
end
class Faalhaas
  include HashTable
  def hi
    p array[1]
    p array[2]
  end
end


this gives me an error at line 5,
and I am very, very certain that every scripter around here would do this very different.
I am almost sure that in def hi the print commands are wrong and probably won't even be called.

what I am looking for is someone who explains how hash tables work and how to work with them.
I have searched among different sites and I couldn't find someone who explained it in a clear way to me.

~Faal

This post has been edited by Faalhaasje: Mar 2 2012, 06:57 AM


--------------------
Y can't we event our own lives ლ(ಠ益ಠლ
Go to the top of the page
 
+Quote Post
   
timm1980
post Mar 1 2012, 08:51 PM
Post #2



Group Icon


Type: Coder




You need a comma at the end of line 4.

e.g.

myHash = {
1 => "something",
2 => "second",
3 => "third"
}
Go to the top of the page
 
+Quote Post
   
Faalhaasje
post Mar 2 2012, 06:56 AM
Post #3


Dutchman
Group Icon


Type: Coder
Alignment: Chaotic Good




@tim1980 oooh lol that's quite stupid of me. I think this can be solved.
[solved]


--------------------
Y can't we event our own lives ლ(ಠ益ಠლ
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 30th September 2014 - 11:04 PM

RPGMakerVX.net is an Privacy Policy, Legal.