Time Nick Message 00:06 MTDiscord <.zenonseth> OK thoughts on formspec tool: - Build formspecs visually + props as agreed - Save/load project to json or maybe also allow browser storage? Exporting for users to use in mods/games: - Option 1: plain formspec string, copy-paste into your mod - Option 2: a ready-to-use .lua file for your mod where every element has a stable ID, so you can: - show the form and fill in text/lists/values by ID, e.g. form.show(player, {title = {text = 00:06 MTDiscord "Shop"}}) returning some object - show/hide elements or update values via an update function - hook up button clicks, list selections etc. by ID with simple callbacks - handle escaping text and typed input getting wiped on refresh automatically 00:07 MTDiscord i was thinking json file so we could read in and out easily, seperate file source control tracked. also could pass params in then 00:08 MTDiscord <.zenonseth> json for the export option? 00:08 MTDiscord yeah 00:08 MTDiscord <.zenonseth> how would that be used by .lua ? 00:09 MTDiscord . 00:10 MTDiscord <.zenonseth> er i see few reasons why that ain't grat 00:11 MTDiscord <.zenonseth> 1. its convoluted to open 2. changing values inside will be done how? json manipulation - which you can't write to mod folder anymore, and mod storage is outside your mod's path + makes it more convoluted 00:11 MTDiscord the idea was db style param replacements 00:11 MTDiscord if we do lua, then would have to parse it for input 00:12 MTDiscord would like to keep it seperate file tho for easy in/out 00:12 MTDiscord <.zenonseth> thats why i was thining save/load project as json, and export being one way only as pure lua file that can be placed and provides a table-like api 00:13 MTDiscord so a user has to keep two files in lock step? 00:13 MTDiscord <.zenonseth> i mean if that's your biggest concern then lua can be made parsable too 00:14 MTDiscord <.zenonseth> but yes, its pretty normal to have a design tool save a project and then export usable output 00:14 MTDiscord <.zenonseth> as two separate things 00:15 MTDiscord <.zenonseth> also you're not keeping two things in lock step, the idea is the .lua wouldn't need editing by user, only edit project -> re-export 00:15 MTDiscord could use fengari 00:17 MTDiscord <.zenonseth> had to look it up, never used it, not sure how it would best work 00:18 MTDiscord if we wanted just a lua file singular for in/out 00:18 MTDiscord regardless of how it works, params are still a tbd 00:22 MTDiscord <.zenonseth> i dont have an issue with a json export per se just don want to make it extra convoluted for users to load or use it, and much rather have a sane lua based api 00:23 MTDiscord makes sense 00:26 MTDiscord there is also luaparse apparently, looks half abandoned tho 00:27 MTDiscord i guess technically one could use fullmoon (rust) -> wasm -> called by js to parse the lua file 00:29 MTDiscord anyways, i just think a two file solution isnt the best because we already see modders struggling with model files. additionally existing mods could format there lua formspec into whatever we use and then use the tool rather than having to convert it into json 00:31 MTDiscord <.zenonseth> i mean if we can do it in one file, it could be better, though part of the issue there is if people go modify the file they may lose import ability 00:32 MTDiscord true 00:33 MTDiscord i would assume tho the app would have an internal state, so one would have two converters, one for in and one for out 00:33 MTDiscord <.zenonseth> > we already see modders struggling with model files. additionally existing mods could format there lua formspec into whatever we use people really struggle with models as separate files? Like much of the industry i know of has the concept of save/load vs export Also one other sort of advantage of separate save/load - we can keep extra metadata there, to make some things easier, things that dont go in formspecs, for example 00:33 MTDiscord designate a button or something as aligned to end of formspec, etc (not saying we should just example) 00:33 MTDiscord search how many mods have blends :p 00:34 MTDiscord <.zenonseth> lol, thats what you mean comitting assets to mod yea ok 00:35 MTDiscord <.zenonseth> can't fix all the issues at once tbh 00:35 MTDiscord <.zenonseth> someone will find a way to save files with like my_formspec_v1.json, my_formspec_v2.json etc 00:35 MTDiscord <.zenonseth> oh that was too clean let me try again: myformspec1.json, myformspecb.json, myformspecnewnew.json 00:38 MTDiscord better one set of those rather than two 00:38 MTDiscord or one edited and the other not 00:50 MTDiscord <.zenonseth> if we can figure out single file format that can handle all that + prob some metadata sure 00:54 MTDiscord anyways, dont have to immediately solve it since 👆 01:36 MTDiscord <.zenonseth> ya fair but while i was at it, we could do like: lua -- Generated by Luanti Workbench Formspec Editor. -- Edit the layout in the tool, then re-export. -- workbench-data-begin local DATA = [==[ { "version": 1, "size": [10, 8], "elements": [ ... ], "meta": { ... } } ]==] -- workbench-data-end local layout = core.parse_json(DATA) -- runtime: render / show / update / on_click / ... 08:19 [MatrxMT] > search how many mods have blends :p 08:20 [MatrxMT] depressingly few, but also I don't include in end user downloads it per .gitarchives because they're huge 08:20 [MatrxMT] the model situation used to be atrocious but nowadays we have good converters so it's almost lossless to retrieve a blend