Nostrademous / Dota2-WebAI

MIT License
33 stars 6 forks source link

Use a lua json parser? #13

Closed ThePianoDentist closed 7 years ago

ThePianoDentist commented 7 years ago

It is possibly to automatically encode lua tables into json.

rather than having to take great care to write valid json.

https://github.com/Elinea/dota2-StorageAPI/tree/master/storageapi

I used this in my bot project and it seemed to work fine. literally just add the json.lua file as a require. and do JSON:encode(mything)

Nostrademous commented 7 years ago

Yeah, and Valve provides one actually. dkjson.lua - I use it for deciding but should use it for encoding too.

C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\scripts\vscripts\game\dkjson.lua