Not my lua, this is from Orestes, posts here and ffxiah, an amazing lua for Nin, should have everything you need plus more.
https://github.com/AlanWarren/gearsw...master/NIN.lua
https://github.com/AlanWarren/gearsw...er-Globals.lua
You'll need his user-globals as well