Here's what I use:
var data = this.wiki.getTiddlerData("TiddlerTitle",{});
var val = data["index_name"];
// ... your code here.... modify 'val'...
data["index_name"] = val;
this.wiki.setTiddlerData("TiddlerTitle",data);
The 2nd param in getTiddlerData is a fallback data object (usually empty), that is used if the specified tiddler is missing. The object property name/value pairs correspond to the index/value pairs stored in the DataTiddler. To add an index to a tiddler, just assign a value into the data array, e.g.,
data["some_new_index_name" = somevalue;
To remove an index from a DataTiddler, set it's value to "undefined" (no quotes).
data["some_new_index_name" = undefined;
When the data object is written back to the tiddler, the entire text content of the tiddler is overwritten with the name/value pairs from the modified object, effectively adding/removing/updating all the individual indices at once.
enjoy,
-e