- Joined
- Jan 26, 2014
- Messages
- 1,281
- Reaction score
- 106
- First Language
- Irish
- Primarily Uses
- N/A
I have been wondering things about modules. My first insight about modules are that they are in any sense, constant. Therefore, things inside them can not be changed.
Example:
module Spirit GREEN = 100 BLUE = 200 Use = falseendthen whenever I want to access Green, I can do a script call Spirit::GREEN. However, this value can not be changed. My question is, though its much practical to include them in a class for them to be easily changed, say you're working on a hash,
Spirit_Core = { 1 => 100, 2 => 300, 3 => 400, }and soon after, I want to change spirit core's value #1 to 400, when its under a module, it can't be done. Would this property be able to change?
For example, I made a module and placed the hash inside it, and wanted to make 1=> $game_variables[1], somehow it won't work.
Can someone explain how module values can work as a class value.
Example:
module Spirit GREEN = 100 BLUE = 200 Use = falseendthen whenever I want to access Green, I can do a script call Spirit::GREEN. However, this value can not be changed. My question is, though its much practical to include them in a class for them to be easily changed, say you're working on a hash,
Spirit_Core = { 1 => 100, 2 => 300, 3 => 400, }and soon after, I want to change spirit core's value #1 to 400, when its under a module, it can't be done. Would this property be able to change?
For example, I made a module and placed the hash inside it, and wanted to make 1=> $game_variables[1], somehow it won't work.
Can someone explain how module values can work as a class value.
