Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> nothing is being added >_>
Adrien.
post Aug 31 2011, 08:25 PM
Post #1


Bet Mapper
Group Icon

Group: Banned
Posts: 1,632
Type: Mapper
RM Skill: Advanced




I might be doing this wrong but:

CODE
class SomeClass

      attr_reader :elements

      def initialize
      end

     def create
         @elements = Array.new
     end

    def add(object)
         @elements.push(object)
         return @elements
    end

   def size
        return  @elements.size
   end

end

someObject = SomeClass.new
someObject.create #works
someObject.add("String") #never adds
someObject.size #nil

#why is it never adding?


__________________________



Games I am working on | Each image is a link to the game
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- Adrien.   nothing is being added >_>   Aug 31 2011, 08:25 PM
- - Turkwise   Looks simple enough...but it does seem to have so...   Sep 1 2011, 09:48 AM
- - Adrien.   because there is create() and create(size) one sta...   Sep 1 2011, 09:52 AM
- - Night5h4d3   How are you checking to see if the text is being a...   Sep 1 2011, 10:10 AM
- - Adrien.   This is my whole script. I didn't want to post...   Sep 1 2011, 10:38 AM
- - Night5h4d3   ah, I see, well, no one's going to fault you f...   Sep 1 2011, 10:56 AM
- - Adrien.   I cannot compound them because unlike other langua...   Sep 1 2011, 11:04 AM
- - Night5h4d3   Ruby does allow optional parameters, like I showed...   Sep 1 2011, 11:28 AM
- - Adrien.   @Size is used to set the size of the array. so if ...   Sep 1 2011, 12:04 PM
- - Night5h4d3   1) @elements.size is dynamic in comparison to @siz...   Sep 1 2011, 12:36 PM
- - Adrien.   It does but it leave me with more question >_...   Sep 1 2011, 01:03 PM
- - Night5h4d3   Well, I cant think of any other way to do this so....   Sep 1 2011, 01:41 PM
- - Adrien.   Would it be ok if I based my script off of this on...   Sep 1 2011, 01:55 PM
- - Night5h4d3   you'd rename class RGSSVector to module RGSSVe...   Sep 1 2011, 02:03 PM
- - Adrien.   Ill have to do some reading up on modules as thats...   Sep 1 2011, 02:30 PM
- - Night5h4d3   You wouldn't need to initialize it   Sep 1 2011, 02:46 PM
- - Adrien.   sweet jesus. Like I said I need to read up on modu...   Sep 1 2011, 02:56 PM
- - Night5h4d3   Credit is fine (IE: special thanks: night5h4d3 or ...   Sep 1 2011, 02:58 PM
- - Adrien.   no no this is purly open source and for free. If I...   Sep 1 2011, 03:05 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 10:25 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker