def world
World.instance
end
s = "meh"
s2 = s
s.slice!(0)
### slices off the first character
### s2 still refers to s and thus both variables refer to "eh"
s2 = s.dup
World.instance.blahblah
class Whatever
def initialize
@world = World.new
end
end
$ cat test.rb
def foo(a)
a = 2
end
bla = 1
print("Before foo: ")
print(bla)
print("\n")
foo(bla)
print("After foo: ")
print(bla)
print("\n")
$ ruby test.rb
Before foo: 1
After foo: 1
class Object
def world
World.instance
end
end
objects (rooms, items, mobs, etc) the reason i'm going to do it this way is because there is going to be one 'world'
and it just seems like a good idea. Now, i noticed something similar in Tyche's TeensyMud base, but i cant figure it
how it works, as far as calling the singleton object.
see, if i want to access on of the worlds lists i would have to do this:
now, is there any other way of access the info without having to type in "instance" everytime?
I know it sounds dumb, but it bothers me.