Thread Tools Display Modes
01/31/23, 12:35 AM   #1
quentinlamamy
 
quentinlamamy's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 24
Nodejs - Saved Variable JSON converter

Hi,

I just create a nodejs script to convert a lua saved variable file to a json. Do you think that there is a need for some other dev. If yes i will publish it on npm.

If you have some specific request of feature , feel free to ask, i will add it
  Reply With Quote
01/31/23, 04:36 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
It could always help to have such tools, thank you.
If you put it on github e.g. we can raise feature requests or contribute.
Or you release it as addon in the tools category here, which is a good way to find them too.
  Reply With Quote
01/31/23, 06:35 AM   #3
quentinlamamy
 
quentinlamamy's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 24
I think i will let the project on github (and published on npm). For the esoui webpage, i can automate the upload and the addon description based on the readme file (i don't have check the esoui api upload yet, not sure if description can be automated)
  Reply With Quote
05/12/23, 11:38 AM   #4
buldezir
AddOn Author - Click to view addons
Join Date: Oct 2018
Posts: 4
without any libs:

Code:
import { readFileSync } from "node:fs";

export function luaToJson(content: string): any {
    content = content.substring(content.indexOf("\r\n") + 2);
    content = content.replace(/\[\"?([\w\$]+)\"?\] = /g, '"$1": ');
    content = content.replace(/,(\r\n\s*})/gm, "$1");
    return JSON.parse(content);
}

export function readSavedVariablesFile(path: string): any {
    return luaToJson(readFileSync(path, "utf8"));
}
  Reply With Quote

ESOUI » Developer Discussions » Dev Tools » Nodejs - Saved Variable JSON converter

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off