Skip to content

Instantly share code, notes, and snippets.

@Jackzmc
Created August 11, 2021 17:29
Show Gist options
  • Save Jackzmc/8c5f4652ab5a8591b7af3adf0a2d69fb to your computer and use it in GitHub Desktop.
Save Jackzmc/8c5f4652ab5a8591b7af3adf0a2d69fb to your computer and use it in GitHub Desktop.
const fs = require('fs')
let version = "2.0"
fs.readFile('./animations.txt', 'utf-8', (err, data) => {
if(err) {
console.error(err)
process.exit(1)
}
const animations = []
const lines = data.trim().split("\n")
lines.forEach(line => {
const [group, anim] = line.split(" ")
animations.push({group, anim})
})
const animLine = animations.map(a => `\t{ "${a.group}", "${a.anim}" },`).join("\n")
fs.writeFile('./animations.lua', `ANIMATIONS_INDEX_VERSION = "${version}"\nANIMATIONS = {\n${animLine}\n}`, (err) => {
if(err) console.error('write err', err)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment