Announcement
Announcement
| 2nd Quarter Contest Announcement posted! See the Community Announcements section. |
![]() ![]() |
Mar 1 2012, 09:25 AM
Post
#1
|
|
|
Dutchman ![]() 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 ლ(ಠ益ಠლ
|
|
|
|
Mar 1 2012, 08:51 PM
Post
#2
|
|
![]() Type: Coder |
You need a comma at the end of line 4.
e.g. myHash = { 1 => "something", 2 => "second", 3 => "third" } |
|
|
|
Mar 2 2012, 06:56 AM
Post
#3
|
|
|
Dutchman ![]() 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 ლ(ಠ益ಠლ
|
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 20th May 2013 - 06:37 PM |
|
|