|
|
|
 |
Posted 2006-08-28, 08:57 AM
in reply to Lenny's post starting "Nice one, thanks. :)"
|
 |
 |
 |
=P It's so easy to use, I forget I'm scripting. I'd suggest, if your going to start writing scripts, making comment lines whenever and wherever you do something. Like...
code said:
#Now to read the .ini file, hello.ini
module INI
def self.read(filename, variable)
File.open(filename).each{ |row|
if row =~ Regexp.new("^" + variable + "=.*$")
return row.scan(Regexp.new("^" + variable + "=(.*)$"))[0]
end
}
end
end
for i in 0..5
puts INI.read("hello/Hello.ini","hello" + i.to_s)
end
|
No, of course I didn't just write that. I was just using a snippet from another script and putting the pound sign to signify a comment which is unreadable to the program, but is readable to you. This .ini shit is higher than what I can do anyway.
|
 |
 |
 |
|
|
|
|
|
|
|