Apologies for jumping in, but I'm trying to do the same sort of source-control operation.
I've got the 'Import' section working thanks to the examples here, but I'm having a right time with the export (converting the Ruby data files to text).
I try this:
actors_array = load_data('Data/Actors.rvdata2')
actors = File.open('Actors.txt', 'w')
actors_array.each do | actor |
actors.write("ID = ")
actors.write(actor.id)
end
actors.close
Which looks to me like the opposite of the loading code, but it explodes quite nastily trying to write the 'actor.id', with the error message 'undefined method 'id' for nil:NilClass.'
I'm assuming load_data() loads an array of RPG::actors, of which there should be two, but it's not responding in that way.
However, if I just print out the string literal "ID =" then I get three (for some reason) copies of it in the output file.
Clearly it's an array of something, but it doesn't seem to like responding to the 'id' request.
Can anyone help here, please? Ta.
*Update* I suspect that load_data() just loads an array of... something, as it's used for loading several different things.
It doesn't know it's supposed to be an array of RPG::actors.
Adding the following inside the loop doesn't help though:
actor_object = RPG::actor new
actor_object = actor