Many authors prefer using a more casual grammatical style, that which is more consistent with conversation of the period, or reflective of the current culture. However, your example is related to the usage of conversational slang, not grammatical structure.
In your example, "the works" is actually an old slang term. It basically means "everything possible", or "every possible option".
Common usage: "Give me a sandwich with "the works" (every vegetable, condiment, and topping available)."
The example:
"When Wayan first found Big and Little Ketut,they hadn't eaten for days, had lice and parasites, the works".
"When Wayan first found Big and Little Ketut,they hadn't eaten for days, had lice and parasites, (every bad thing that could have possibly happened to them)".