#Umbrella Project
1 messages ¡ Page 2 of 1
just a curiosity really
Oh, did I?
Well I do love python, but don't feel the need for writing python mods đ
Hahaha darn. Okay then.
request to pin links
?
What do you want to pin?
@lusty steppe Hey. You've been pretty silent for a bit. Are you still planning to implement Rosetta's schema at some point?
I might fork your project and add support myself.
Still planning to at some point, yeah. Between work & personal stuff I've been a bit busy. Wouldn't be opposed to you forking it, but I still had a significant restructure in the works for how everything is handled
I can sanitize the code loading Rosetta.
The reason why I'm interested in your end is because I'd like to start documenting the Lua-side API myself.
I'm going to be moving this week & weekend so I don't anticipate being able to do anything until next weekend at the earliestâI did have some ideas about how the schema may need to be tweaked (into a superset) to account for some Lua stuff, but I'll have to take a closer look to know whether that'll be necessary
I entirely expected this so don't worry.
@lusty steppe Did any of the code I referenced that uses luaparse help you?
Simply curious is all.
I used the same method for sanitization of break; and numbers; I believe that's all
Heheh..
Glad that helped someone else.
It was a pain when I had to figure out what was the issue.
Really ought to add an issue for that break thingâI saw where in the luaparse code it was causing an issue but I don't think I made a issue for it
I doubt they'd handle the number thing since it's non-standard
Lua is fine with break and ; so it is luaparse.
The number thing is non-standard and correct for luaparse to lexically fail.
It's something that Kahlua is okay with because they deliberately ignore it. It means nothing.
TIS is writing pseudo-Java in Lua in those blocks.
Yeah it's definitely luaparse, I mean I found where in the luaparse code it's failing
Probably needs a gentle push via pull request of fork.
And that I doubt they'd add a "fix" for the number thing considering that
I'll probably start with an issue at some point and do a PR if not fixed. Last time the maintainer was pretty quick with the fix when I pointed out where the problem was
Nothing too special, but it is using rollup
I don't remember whether I included a build script command in package.json. I think I just used a vscode build task
I can add one.
When using it you'll need to specify an input and output directory with -i and -o flags
I'm going to use your project to write the Typescript Rosetta API and then separate it and release it as an npmjs module.
Sounds good
So I'm a virus.
lol
Turning your project (The cell) into a virus production factory.
x)
BTW Rosetta has a Java library. I haven't published it on a maven repo yet.
It's not actually done. I'm to write the patch loading and overriding part at some point.
We get to a point where both Java and Lua API has rosetta support and I can start documenting.
I can't seem to run your compiled JS file outside of the yargs entry point.
I get no output.
node pz-doc.js -in 'assets/lua/' -out 'dist/lua/' -verbose true
Yeah.. yargs is not fully executing for some reason.
@lusty steppe
Spent my lunch today trying to figure that out. =/
Unsure what would be happening there. No output whatsoever, including no errors, I presume?
Yeah, even if I know it should error.
I ran node against a console.log test file and it outputted.
Something's getting stuck at the processing of the entry-point of the program.
I expected some sort of error or console logging when running your built js file.
npm i
npm run build
node pz-doc.js -i .. -o ..
.command('annotate', ..
God damnit.
I wasted an hour not realizing I had to write annotate
yargs should complain when you don't have a command.
Adding a README.md file.
npm i
npm run build
node pz-doc.js annotate -i <DIRECTORY> -o <DIRECTORY>
Got it working.
In your defense I missed that above too, lol
lol
You can use the JSON flavor of Rosetta.
You don't need to use YAML.
(I spit out both)
"scripts": {
"build": "npx rollup --config",
"start": "node pz-doc.js annotate -i assets/lua -o dist/lua -v true",
"dev": "nodemon --watch **/*.ts --exec \"npm run build & npm run start\""
},
đ
Having issues with the watch part but the execution part is working fine.
"build": "npx rollup --config",
"start": "node pz-doc.js annotate -i assets/lua -o dist/lua -v true",
"dev": "nodemon -e ts --exec \"npm run build & npm run start\""
compiles and runs.
So that's mostly set up. I'll need to implement the Lua schema objects.
Since we have no way to generate Rosetta datasets for the Lua API, it'll be driven by custom patches.
Just noticed that the Events API is generated from Python 3.
lmk if you need a Rosetta API implemented in Python 3.
i just chose a language i knew how to write scripts in, i honestly wanted lua but making a standalone lua program seemed annoying
I have no preference. I want to give you tools if you need them.
Just started the 2nd phase of Rosetta.
I'm thinking of looking into making an environment where mods could be scanned for typings.
Would be great to generate or hand-write typings and distribute them with the workshop mods.
I tend to include handwritten typings, generating sounds interesting but I wonder what that'd look like
It'd largely depend on the quality of the discovery of Lua entities.
Was there a recent marketing push for Umbrella? I'm noticing an uptick in GitHub repo activity.
not that i know of, i've been mentioning it when i can though
Well someone's marketing it. (Or spreading via word of mouth)
Sneaking in some work on the Lua stubs stuff.
Writing the patch API.
Been updating the schema to reflect changes and improvements.
################################
## LOADING PATCHES ##
################################
Loading patch: assets/rosetta/patches/jab ..
Reading file: assets/rosetta/patches/jab/json/client/isui/ISUIElement.json ..
Loading Lua Class: ISUIElement
{ notes: 'This is example notes for ISUIElement.' }
{
"$schema": "https://raw.githubusercontent.com/asledgehammer/PZ-Rosetta-Schema/main/rosetta-schema.json",
"luaClasses": {
"ISUIElement": {
"notes": "This is example notes for ISUIElement."
}
}
}
The patch API is taking shape.
Heheh.. I'm already pushing data to the Lua type stubs. @lusty steppe =)
--- Draws a texture on the screen using top-left coordinates and a color multiplier.
---
--- @param texture Texture2D The texture to draw. If null, the color will be the texture.
--- @param x int The x coordinate on the screen to draw the left of the texture. (In pixels)
--- @param y int The y coordinate on the screen to draw the top of the texture. (In pixels)
--- @param red double The red color value to draw. (Range: 0.0 -> 1.0)
--- @param green double The green color value to draw. (Range: 0.0 -> 1.0)
--- @param blue double The blue color value to draw. (Range: 0.0 -> 1.0)
--- @param alpha double The alpha value to draw. (Range: 0.0 -> 1.0)
---
--- @return void
function ISUIElement:drawTexture(texture, x, y, red, green, blue, alpha) end
This is what I'm currently rendering with the above, hand-written Rosetta patch.
@lusty steppe @languid walrus
great stuff!
Working on fields.
@languid walrus @lusty steppe
I haven't tested documenting tables or global functions / global values yet.
yay!
So.. Lua has their own schema objects.
This adheres to and simplifies the datasets digested by Rosetta when ran.
Also.. Sorry Omar.. I sort of blew up the source folder.
Because Rosetta supports patches this opens the door for multi-lingual patches.
Even though it's good to know English for programming in general, documented notes in French or Portuguese would be far more helpful to some.
Even though I haven't implemented patching on the Java side (Candle), I can start documenting the Lua API now.
=)
Spent today getting us this far along.
When this works for both Candle and LuaStubs then I can plan out a GUI for simplifying the process.
great work!
Thanks.
We could do stable releases.
Might make it easier on people since not everyone is a wizard at Git.
The only file I modified for the actual code for PZLuaGenStub is annotater.ts.
Everything else is sanitized.
I'm not sure what's happening with tables with the Lua stub.
Not seeing any annotations for table structs.
I'm reading through the code ATM and I don't see anything about table annotations except for rewriting tables.
Okay so from what I'm getting the name is handled at the root level of annotate() and not passed because all annotater does for non-classes is write them back into the distributed result lua files.
I think I intentionally didn't mark certain tables as classes since they had looser typing or were intended to be extended. I'd have to look again though
Hey. No problem. The only two things are needed to be known: Name & properties.
So like I can simply support nested Rosetta definitions by calling the item from global.
I'm not interested in generating Rosetta datasets for Lua at this point.
This is where I think that writing by hand is a good idea / approach.
Java is rigid enough to generate and then apply handwritten patches.
@lusty steppe I did a lot to your project but again it's only in the annotater.ts file. Are you okay with this?
Created a private repo for tracking changes to the game's Lua code.
@lusty steppe For nested type defs, I can use:
--- @type table<string, {index: number, spawnChance: number}>
local trafficjamVehicles = {}
trafficjamVehicles["Base.CarNormal"] = {
index = -1,
spawnChance = 20,
}
For now, what I could do is only apply types at a global scope and any predictable formats can be nested type declarations like so.
Yeah, all good. If you make a PR I'll take a look at itâprobably won't be doing a thorough review, just for my benefit
This is what I had in mind but I wanted to define it in the yaml/json files. Is this what you mean?
If you have a potentially better way via analysis I'm not opposed, but that sort of thing seems better suited for that
Gotcha, sounds good
Doing more nuanced definitions would be overengineered IMO.
I should note when I say I'll take a look, still not any time soon unfortunately
I'm already applying Rosetta for classes if you look up.
.
Oh yeah, I saw these messages but was too tired to respond when I did lol, looking good
Thanks.
It doesn't have to be 100% Rosetta supported immediately.
If I can start documenting and have a good percentage documentable then this leave all the time in the world for you to figure out your next steps.
The only thing I might tweak right now is static fields.
I'm on board with that, wasn't big on the way the stubs handle them right now anyhow
If you don't mind me modifying your code then I'll simply keep at it.
The pivot to analysis was intended to somewhat handle that, so it may end up changing a bit. Make all the changes you like though, I'll just have to read through it when I'm free to work on this again
Yeah. I did what I said so far with sanitizing my API.
So it's only calling from a loaded Rosetta instance and using the API to apply data when present.
Ended up going full cyclic when simply trying to upload my Rosetta API. xD
(Been optimizing)
So my linter just advised me to clean a lot of stuff haha.
Will have to do it later.
It's professional. \o/
Okay so..
I'm going to pull the trigger and begin working on the software to edit patches.
But before I do, I'm going to work on PZLuaStubGen and get it to use the npm module I just made yesterday right before sleeping.
Then I'll form a pullreq.
@lusty steppe Submitted first pull request. =)
The pz-rosetta-ts code is completely out of your source folder.
So PZ-Rosetta now has an official typescript library on npmjs.
Battling overflow scrolling problems but worked on modeling the software today..
Zero functionality. Entirely CSS / HTML.
Due to a fun mix-up I don't have internet at my new place yet (and won't until Wednesday at the earliest), so won't be able to give it a good look for a bit
Looks nice
Thanks. Webpack terrifies me
Always happens.
Looks great!
Thanks.
Webpack is cryptic to me.
I do need to properly learn about it.
I took a crash course on Webpack today. I know it far better now.
@gleaming kettle You'd be interested in the works going on in here. =)
Pinged you here since I'd take over the mod channel
I made it for the collab project 'Umbrella'.
Seemed convenient to keep development adjacent to it here.
PZ-Rosetta allows me to bake this information into the EmmyLua typings rendered through the Lua stubs generator project by Omar that I modified.
yea, that's cool 
The goal is to provide typings for Java and Lua API while also providing additional documentation on-top.
One thing I noticed anyone could do with Rosetta is write typings in other languages than English.
=)
Going to try to crash course modern Electron soon.
The last version that I barely managed to work with was in 2017 and was Electron 7.
@languid walrus Thought: extension for Umbrella in vscode that uses fernflower to decompile methods and other items in Java files in the game.
Do it as a preview sort-of-thing
that'd be beautiful
There's a fernflower-wrapper extension on vscode atm
I'd like to write my own though.
I am making progress on Rosetta Workbench
Doing actual work rn but yeah.
I'll template out the type forms and then work on selection and assignment code.
After that, loading and saving patch files.
Getting there..
@lusty steppe How goes the Internet crisis?
@languid walrus I was thinking of using Steams public API to download mods in a node environment and extract typings from a specific folder in the mod for mod API support / extensions.
@warped plover Maybe you can add this to your PZ-Studio solution.
So something like /contents/mods/{mod}/media/lua/types/**/*.lua as a filter when searching for typings in a mod project.
Mods should be capable of writing their own typings.
i just load the mod as a library when i need to
(also if we were to do this it should not be in the lua folder so that it doesn't execute)
only client, server, and shared are loaded.
oh yeah sorry i just woke up LOL
Folders inside without those three names will not execute.
All good.
I'd like to figure out a solution to automatically drag in typings from mods.
This would be incredibly helpful for people trying to work with existing mods like TrueMusic.
not with the way they're written
Which is why I like the idea of a typings folder.
i'm not sure i understand what the benefit is as compared to annotating the lua
It would keep full documentation clean and separate from the actual source which can be harder to document.
Then again, I'd personally want to see clean code with documentation and types all together as one package.
Pointing to /lua/**/*.lua might be best because it'd allow for both scenarios.
it'd be nice in the cases where we have to go around the actual mod authors i suppose
Sometimes code is too crazy.
Yeah. We could make an option for npmjs modules.
@pz-types/[MOD_ID] as a module.
For this to work it'd have to be a plugin in PZ-Studio or another node environment.
Buuuuuuuut
I think it's worth the work.
Internet is here, brain needed a bit more time. I looked over the PR and I have no huge objections, but some points of curiosity:
- Adding the semicolons to
annotator.tswas the result of linting, I assume? (I am staunchly anti-semicolon in TypeScript, but not staunch enough to not accept a PR for it) - Why did you add spaces before the
@sign in the annotations? I generally write annots with---@and not--- @. Doesn't really matter all that much, but it will unnecessarily inflate the size of the result annotations a tiny bit
Asking here rather than on the PR since they aren't really functional problems
- Probably the linter.
- I want to conform with the Java typings.
Fair enough, but the same question applies to those
Since you're rewriting portions of it I let you decide whether to revert or deploy something else.
It was my way of rapidly deploying these changes over the past weeks.
Okeydoke. I'll run the annotations to give it a closer look then merge
Ah gotcha
By all means, check it out.
All Rosetta does is loads the dataset and patches and allows you to look up additional information to apply to the typings when rendering them out.
Now that I'm set up at the new place I should be good to merge it any evening. Will hopefully be less busy outside work hours
Right now I'm refactoring the I/O API.
I basically want the API to have the capability to produce patches programmitcally.
This is how clean I plan to make all code in the API.
Nice. Documentation is something I need to get around to eventually, too
"Clean as I cook" is the method I try to follow.
I found one minor thing to change, but see no issues otherwise. Left it as a review on the PR
Awesome. Will update things later.
My test:
const rosetta = new Rosetta('assets/rosetta');
const patch = rosetta.createPatch('test', {
name: "Jab's Test Patch",
version: '1.0.0',
authors: ['Jab'],
description: 'This is a test patch.',
priority: 1,
});
const file = patch.createFile({ uri: 'lua/client/ISUI/ISUIElement', type: 'json' });
const clazz = file.createLuaClass('ISUIElement');
clazz.notes = 'This is a class.';
const { conztructor } = clazz;
conztructor.addParameter('x', 'number', 'The x coordinate. (In pixels)');
conztructor.addParameter('y', 'number', 'The y coordinate. (In pixels)');
conztructor.addParameter('width', 'number', 'The width. (In pixels)');
conztructor.addParameter('height', 'number', 'The height. (In pixels)');
patch.save();
My result:
I'm not done with the upgrade but the foundation is there and working
Decided to work more on PZ-Rosetta API this evening..
It's funny how such a simple-sounding solution when blown up logically is actually a lot of work.
A lot of progress was made today.
I'll need to optimize the JSON schemas and do some cleaning for rendering java patch files.
A good victory, even if it's a quiet one.
I'm wondering if I should try to move pz-rosetta-ts from a destructive solution for applying patches to the original dataset after loading them.
I don't think it hurts anything since the goal is to simply compile and apply everything together..
What are the plans for lua stabs? Will types be added? @lusty steppe
I do intend to more strongly type eventually using Rosetta, but may need to be a community effort
Gonna do a rewrite of the generation code first
Neglected to reply & was otherwise occupied while sending those, so to add some clarification on the community effort bit: while I'm sure I can cover a fair amount (and I intend to), I think it wouldn't be reasonable for me to try to provide full typing for the Lua codebase on my ownâI would likely get tired of it quick. I'll have to see how much of it can be automated with analysis of the code, but if it's not a substantial amount (or not accurate to a degree that's acceptable) it'll require a fair amount of manual work
I can certainly coordinate that work for anyone who wants to contribute. This is likely a bit of a ways off, since I haven't been prioritizing this project, but I can try to do some more work on it if stronger typing is something that'd be handy
If it needs manual work then it would be better to set up a system for the community to contribute.
Yeah, likely would just be via contributing to the repo; having it organized by what needs to be done would make that easier nonetheless
Hopefully a significant portion of it can be automated, though. Unsure when I'll be able to get around to it, but the repo is open to contributors now too
hm, would adding a short comment for field with usage and default be useful?
e.g.
---@class ISBaseTimedAction : ISBaseObject
---@field character IsoGameCharacter
---@field maxTime integer special case: -1
---@field stopOnWalk boolean true
---@field stopOnRun boolean true
---@field stopOnAim boolean false
---@field caloriesModifier float 1
---@field useProgressBar boolean true
---@field forceProgressBar boolean false
---@field loopedAction boolean false
---@field action LuaTimedActionNew
---@field [any] any
ISBaseTimedAction = ISBaseObject:derive("ISBaseTimedAction")
@languid walrus
https://github.com/LuaLS/lua-language-server/issues/2368
I don't know if this something worth adding.
sure, will see if it plays nice with intellij
I believe rosetta supports this, but I'll have to look into itâit isn't documented, but the code seemed straightforward to read through & understand
That said, that part wouldn't be able to be automated at all (I guess defaults could maybe be, but that wouldn't be foolproof)
Thoughts on removing the ---@field [any] any once the stubs are improved? I think the original concern was missing extra fields, but classes can always be extended by end users by marking their variable with the same class annotation
Well not having it can help you find typos or issues faster. On the other hand it can be rather annoying at times, but as you said it's rather easy to add new fields.
That being said, it can be set to the ISBaseObject class and all derived classes have it too.
It may be nice to add to derived classes, otherwise it shows me ---@field Type newClassNameISBaseObject.
newClass.Type = className
Makes sense, that can be added to classes created with :derive
True, but this would have the same issue of weak typing
oh, I guess the defaults could be set the same way.
But for the ISBaseTimedAction they are not actually there by default, but in the java action.
Yeah, that's how a lot of (static) defaults are set currently
I don't have special handling for ISBaseTimedAction right now, though
Finally made some progress on the rewrite: started on analysis. See: this huge JSON file of the game's Lua files' dependencies đ
Gonna clean them up to ignore stuff like print (or make a best effort to do so), then should be able to resolve guesses for types & better define classes
A fun insight from this: a mapping of the globals the game sets to the filenames that set them (the ones I've successfully tracked, anyway). I wonder whether there's a not-rude way to compile a list of likely unintentional globals (looking at you, o, y1, y2, g, b, ...) and convince the devs to clean them up đ
doesn't super matter ofc but the globals are already polluted enough as-is with the intentional ones
OnAiStateChange also triggers for remote players.
@kindred jay
Hi?
Yes because that helps with autocomplete.
check omars replies for contributing
If it's just any then it'll be unknown.
@languid walrus Was there some file (or set of files) that you'd said isn't picked up by the annotator sometime in the past few months? I vaguely remember something like that but can't for the life of me find it
I've refrained from mentioning it to not jinx myself and lead to another October-of-2023-that-turns-into-never, but I've been rewriting it (again) the past few days
i've noticed it doesn't like the new mod options, i was wondering if that was because it's nested in another table
PZAPI.ModOptions iirc, i think it's just annotated as table? i didn't look into what exactly was going on but i don't get completion for any of the functions in there
Gotcha, I'll take a look at that while testing. It might be because of the local Options = PZAPI.ModOptions.Options, but the new way of doing things should be able to handle that fine
Thank you!
by the way, any plans to have a skip/override file feature? it doesn't really matter but the item distributions and recorded media definitions get dumped in their entirety into the output and it ends up being almost the entire filesize of umbrella
Yeah, Jab had left an issue about that; those should definitely just be handled via rosetta annotations describing the tables
I was gonna add a heuristic to not include fields for tables with > X fields, but I think an option for it should be fine
Still a whole lot of bugs to work out with the type analysis, but here's a cherry-picked example of a file where things all went right:
---@meta
---@class ISLightSourceRadialMenu : ISBaseObject
ISLightSourceRadialMenu = ISBaseObject:derive("ISLightSourceRadialMenu")
ISLightSourceRadialMenu.Type = "ISLightSourceRadialMenu"
---@return boolean
function ISLightSourceRadialMenu.checkKey(key) end
function ISLightSourceRadialMenu.onKeyPressed(key) end
function ISLightSourceRadialMenu.onKeyRepeat(key) end
function ISLightSourceRadialMenu.onKeyReleased(key) end
function ISLightSourceRadialMenu:center() end
---@return any?
function ISLightSourceRadialMenu:getInsertBatteryRecipe(item, containerList) end
---@return any?
function ISLightSourceRadialMenu:getRemoveBatteryRecipe(item, containerList) end
function ISLightSourceRadialMenu:fillMenuForItem(menu, item) end
function ISLightSourceRadialMenu:fillMenu() end
function ISLightSourceRadialMenu:display() end
function ISLightSourceRadialMenu:onEquipLight(item, primary) end
function ISLightSourceRadialMenu:onInsertBattery(item) end
function ISLightSourceRadialMenu:onRemoveBattery(item) end
function ISLightSourceRadialMenu:onToggle(item) end
function ISLightSourceRadialMenu:onLightCandle(item) end
function ISLightSourceRadialMenu:onExtinguishCandle(item) end
---@return ISLightSourceRadialMenu
function ISLightSourceRadialMenu:new(character) end
No more misleading ---@return any on functions that don't actually return anything đ
great work!
Just pushed the rewrite to https://github.com/omarkmu/PZLuaStubGen/tree/rewrite-2025. I did most development against b41 but the last hour was spent confirming things look okay for b42. It can at least handle ModOptions & a few of the other new patterns for classes (FishingManager, Bobber, Fish, FishingRod)
But I'll have to do a more thorough look to see if there's any other weirdness, beyond the one last nice-to-have I'm already aware of (other than the exclude option, which I also have down to do)
awesome! i honestly haven't paid too much attention to the lua side of b42 so i wouldn't be able to review that much
I'll be doing a whole lot of review myself so no worries thereâwant to make sure everything is working as expected before fully moving over to the new generator
Once it's all looking good I'll (hopefully, given that I have enough time and interest) start on the manual Rosetta typings for b42 so the community typings can get off to a good start
@languid walrus To avoid surprises when the next unstable build rolls around: stub generator rewrite seems ready for primetime (has for over a month, really đ
), merging shortly. Letting you know bc the annotate command has been changed to the base command, among other changes summarized in the PR
I also recommend using the --no-ambiguity flag until the stub data is ready; changes types analyzed as unions to unknown
Separately, regarding events: the TradingUIRemoveItem event's second arg has a different meaning in b42 (index â item id). I'd make the change myself but idk where the unstable data lives
@thick ravine see above (just remembered you're back in this server)
fantastic! i'll check it out in a second
thanks! i'll make that change, for future reference it hasn't moved at all, i decided not to fork it off for stable/unstable since realistically i wasn't going to update stable anyway
Ah, that makes senseâgood to know
finally got to try it, this is great! much higher quality output than before, this will be really useful
Of course, the day after saying that I found some areas for improvement đ This one in particular seems potentially worth waiting on before using the new generator since it'll lead to some changed names (planning on knocking that out today or tomorrow)
Fixed
got a chance to try it, looks good!
I wanted to figure out all of the potential values of the rules from OnSteamRulesRefreshComplete & for some reason I decided the best way to do this would be trudging through the ZNet .dll
I'm sure there was an easier way that wouldn't have given me a headache, but long story short the "rules" are just server properties that were set with SteamGameServer.SetKeyValueâand plenty of calls to that can be found in GameServer
The fact that they're properties was unsurprising, of course, but being right there in the decompiled Java was less obvious for some reason đ¤Ś
Soonâ˘ď¸
I'm still here. I still read stuff. Been busy lighting fires in the hacking sector of PZ with stronger anti-cheat implementations.
About to fall back to the rewrite of Mallet when I'm finished setting up this bonfire.
I'd like to somehow eventually write a nodejs module that allows for setup of a mod project with run scripts and the ability to import Lua typings for mod API.
A thought that recently came back to me as I write EtherHammerX documentation.
I placed this in my types/ folder of the project:
i just add the mod itself as a library when i need typings from a mod
Ah yeah. What do you think about some sort of typings standardization approach?
Would be cool to pull from a workshop item using a steam API and importing typings files.
i think it'd be cool but i just honestly don't see much use to it
The primary (or potentially only) utility I'd see in that sort of thing is documentation for an APIâI've had it in the back of my mind to figure out a good way to make that clearer. I'd be more likely to opt for exporting the docs using a LuaDoc-esque tool, though
To clarify the distinction: I mean it'd be for the documentation text rather than the typings
Personally I'd like to write a React + NextJS web application that renders a website from LuaCATS typings.
I named this planned project "CatHouse".
I'll prob just fork an existing doc tool since the main blocker is that they use a different annotation format
Interested to see where that goes though
yeah that'd been in my backlog too but i'll probably leave it to one of you then
I write code that writes code.
So it'd naturally fall on my hands lol
x)
Also legendary post in #mod_development earlier:
I will never endorse Lua slander đ¤ No matter how many times it disappoints me đ¤
As an oldhat I find this funny.
=D
Been around way too many arrogant C programmers.
Working on CatHouse would be a great opportunity to modernize JavaDocs-like solutions and make a clean documentation design for mobile.
First pass of Rosetta files for the Lua source is done. Just type annotations, no documentation, but it's a start: https://github.com/omarkmu/pz-lua-stubdata
In the interest of never doing that again making it easier, for future state of the stub generator I'm thinking I'll add functionality to feed the java Rosetta files to it so it has more context for currently unknown calls
Which would cut down on manual work a lot, in theory. In any case, review of the above would be appreciated if anyone has the time to give it a look. You can run the generator with that data as pz-lua-stubgen -i <pz directory> -o <output directory> -r <stub data directory> -k --helper-pattern ^umbrella\.
One currently known issue is that JoypadData should probably be optional in most of the places it appears
oh man, i just pushed the 42.7.0 update đ
All good, I'd rather this have review first anyhow
so stubdata is rosetta data for the lua?
Plus I just realized I didn't push the stubgen update, whoops
Yeah, the stub generator has some commands to initialize & update it and I went through the codebase and manually annotated stuff it couldn't figure out automatically
oh i see! i was wondering what those commands were for
Unfortunately I think it'll always require manual review due to the untyped nature of Lua, but ultimately I'd like for the manual part to be as minimal as possible
It's cool to see Rosetta being used like I wanted.
Damnit @lusty steppe Stop reminding me of how fun it would be to write a type-discovery mapper for Lua code.
hahaha
It's been on my mind like 5 times now.
You could always make stubgen better đ
What do you use? luaparse?
I can only think in a blank canvas for something this big but I'd write it out as a utility that could be integrated into PZStubGen. Would that work?
I'd write out scope-identity strings like _G.someFunc.forloop_3.x = [number, string]
I'd have to write out calls to variables using scope-visibility checks on other identically-named variables and then map all assigned types to a type-array.
See? You did this to me.
xD
I was thinking about how to approach the problem.
Yeah luaparse, then it goes through & checks assignments to do stuff like that
Currently assigns locals, functions, and tables to IDs for tracking & then does type resolution based on assignments & usage
It just reads top-to-bottom, though, so some resolution that's theoretically possible isn't done
The code for all that is in the AnalysisReader and AnalysisContext files which sorely need a refactor
(all of that to say it sounds like it already has that, but if you identify gaps or improvements I'd happily accept them)
Would you be comfortable if I wrote the solution in isolation and then handed it over?
Sure, I could compare & see how to integrate it
I'd like to make it more universal for any Lua 5.1 project with overrides from a source that patches unknown types from PZ.
Makes sense. I have a few PZ assumptions I was gonna tie to an on-by-default flag
It should be set up to work somewhat generally but can't make very many assumptions about the environment yet
I was working on the React + Next.JS rewrite of Mallet for albion and I to start documenting the Java API however I can also work on this in the meantime.
I also just finished the rewrite for a secure, modular and client-side anti-cheat for PZ so I could shoe in this project where that one ends.
@lusty steppe caught a weird quirk, target should probably be annotated as any if anything
I think I added a heuristic for that but only applied it to Rosettaâit would def make sense to ignore call signatures for that, thanks
Got around to fixing this (committed to main instead of a PR + version bump as usual because I am lazy), moved from the Rosetta generation code to the analysis part
Also I'm gonna add you and @thick ravine as maintainers to that & my other stubs-related stuff if there are no objections to that
Last also: plan currently is to wait for b42 to be stable to update & maintain the Rosetta stub data instead of trying to keep it up to date with every unstable patch. I think (/hope) the automatic generation with the default flags will suffice until then
Thanks for the update and I'm OK with it
It's so cool to see that Rosetta actually helped out
Definitely, once we're in stable I think it'll be good to try to get the community to contribute to the documentation
I always wondered that Rosetta was a personal thing and that it didn't help outside of my interests
I try to be real about that so thanks for trying Rosetta out and letting me know
4real yall are awesome
Right back at you
great work!
Apologies for the likely email spam with the 3 repository invites
Mostly adding y'all in case I vanish off the face of the Earth (even though you could & prob would fork anyway, but this makes it easier I suppose)
- the bonus of allowing commits if I'm taking too long đ
thanks!
i've realised i'm not including your stubdata in my umbrella builds, will have to remind myself to do that
Probably best not to for now given I doubt I'll be updating them on pace with b42 updates lol (not until stable anyway, see #1108874445319307384 message)
Although I suppose the rosetta-update command would make that a non-issue, idk I figure oughta have it when it's all good to go
Crazy idea: Modify Kahlua to map out types assigned to variables in scopes to a file and use that for Umbrella.
@lusty steppe I wonder if this would work.
I could look at how Kahlua stores and recalls contexts and then map them based on those calls.
If that could be proven to work we could give this patch to players to bake the type maps of Lua code.
x)
A funny way to solve that problem.
So it'd be mapping out types at runtime? Sounds interesting, but odd
Was a silly thought but it could help.
@lusty steppe not sure why, but no type stubs are emitted for these functions:```lua
function CharacterCreationMain.sortByCost(a, b)
if a.item:getCost() == b.item:getCost() then
return not string.sort(a.text, b.text)
end
return a.item:getCost() < b.item:getCost();
end
function CharacterCreationMain.sortByInvertCost(a, b)
if a.item:getCost() == b.item:getCost() then
return not string.sort(a.text, b.text)
end
return a.item:getCost() > b.item:getCost();
end
function CharacterCreationMain.sort(list)
table.sort(list, CharacterCreationMain.sortByCost);
end
function CharacterCreationMain.invertSort(list)
table.sort(list, CharacterCreationMain.sortByInvertCost);
end
Thanks, I'll write up an issue. I'm guessing this has to do with the dependency resolution being fairly rudimentaryâthese are defined in CharacterCreationProfession, so most likely cause is that CharacterCreationMain is loaded after that
Should be fixable by extending the "implied class" logic to unknown globals when encountered as a function identifier member expression base
