Created
August 11, 2021 17:29
-
-
Save Jackzmc/8c5f4652ab5a8591b7af3adf0a2d69fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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