#Umbrella Project

1 messages · Page 1 of 1 (latest)

thick ravine
#

@languid walrus @lusty steppe

#

Oh and "Umbrella" is a good name candidate.

languid walrus
#

i like it

thick ravine
#

But seriously Umbrella is a tool in PZ and fits what goal the project serves.

#

Either of you want to host the git repository?

#

Asking before I'd make one out of respect.

languid walrus
#

it doesn't really matter to me

thick ravine
#

@lusty steppe Is this ok?

lusty steppe
#

Sounds good to me & I'm okay with anyone hosting the repo

thick ravine
#

Awesome. I'll create the repository for us. One moment..

#

Sent invites.

languid walrus
#

accepted!

thick ravine
#

I gave both of you maintainer roles.

warped plover
#

👀

warped plover
languid walrus
#

i use emmylua in intellij, from what i've heard for vscode luacats is compatible with emmylua annotations and is generally a better plugin

lusty steppe
#

I use lua-language-server (which uses LuaCATS), which has slightly different annotations

#

Mostly compatible but some differences in how annotations are interpreted + some additional annots. I don't think the breaking changes will matter for our use case but I'll have to check on that

thick ravine
#

we could produce safe, compatible annotations.

thick ravine
languid walrus
#

oh beautiful

thick ravine
#

Added the modifiers just now.

#

So yeah.. A digestible YAML file with the info scraped from the JavaDocs.

#

I'll write a batch process later.

thick ravine
#

I have a working batcher. I'm currently implementing support for enum constants.

thick ravine
#

Working on param documentation...

thick ravine
#

Doing some optimization of the files, then I'll DM the initial renders @languid walrus

languid walrus
#

sounds great!

thick ravine
#

Yup. I include the existing documentation that TIS provides.

#

Also @deprecation tags.

#

@lusty steppe

#

Okay. Turning back to work on Candle to implement this new data.

#

This data is publicly available for others to use to build their own tools.

warped plover
warped plover
#

i know

#

xD

#

tho pipewrench already has that

thick ravine
#

It's nowhere near perfect and without type specificity.

warped plover
#

yeah

#

Ill try something lol

thick ravine
#

If that's expected of me, pay me lol

#

Doing the JavaDocs scraper wasn't a big deal.

#

Just coded that in one go.

warped plover
#

Hey Id pay you but im poor too

#

So I asked chat gpt 4 to create proper **emmyLua **annotations to a piece of lua code.
The piece of code:

ISBaseObject = {};

ISBaseObject.Type = "ISBaseObject";

--************************************************************************--
--** ISBaseObject:initialise
--**
--************************************************************************--
function ISBaseObject:initialise()

end

--************************************************************************--
--** ISBaseObject:derive
--**
--************************************************************************--
function ISBaseObject:derive (type)
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.Type= type;
    return o
end

function ISBaseObject:new()
    local o = {}
    setmetatable(o, self)
    self.__index = self
    return o
end
#

gave me this:

--- @class ISBaseObject
ISBaseObject = {};

--- @type string
ISBaseObject.Type = "ISBaseObject";

--- Initializes the base object
-- @function ISBaseObject:initialise
function ISBaseObject:initialise()

end

--- Creates a new derived object with the specified type
-- @function ISBaseObject:derive
-- @param type string the type of the derived object
-- @return table derived object
function ISBaseObject:derive (type)
    --- @type ISBaseObject
    local o = {}
    setmetatable(o, self)
    self.__index = self
    o.Type= type;
    return o
end

--- Creates a new instance of the base object
-- @function ISBaseObject:new
-- @return table new instance of the base object
function ISBaseObject:new()
    --- @type ISBaseObject
    local o = {}
    setmetatable(o, self)
    self.__index = self
    return o
end
thick ravine
#

If you want to work with AI stuff that won't bother me. I won't be adding any AI-generated materials in my repositories, though.

warped plover
#

i mean it need supervision

#

could be loaded of false incorrect info

#

especialy with pz lua

thick ravine
#

You're correct. It would need a lot of work.

#

I also see this as a hobby, art, and trade. I'd like to work on it myself. I find it rewarding. Maybe I will do my own parser for the Lua side eventually.

warped plover
#

I got too much on my plate with just daily work to go into big enterprise online

#

small mods are okay but going nuts with big project too much atm

#

pzstudio i did it in one run yesterday, as to get a working prototype without losing focus but other than that I barely have 2 hours a day to go online now. tired

lusty steppe
#

pz-zdoc took a fairly liberal approach of just applying class annotations where it seemed to match in the Lua source iirc. I might use an existing Lua parser to generate stubs so the full source doesn't have to be used for that

languid walrus
#

something like that would be helpful, i had to stop using that library because of it failing on certain files for some reason

thick ravine
#

The code I wrote to generate my YAML files is very small.

#

It's in TypeScript under a node environment.

#

~530 lines (With some comments)

thick ravine
#

Table declarations and invocation of derive and new.

lusty steppe
#

pz-zdoc does the first two. Idk about looking for tables, seems like it'd generate a lot of unnecessary annots

thick ravine
#

That'd at least grab the bulk of it.

#

I did this quickly for PipeWrench.

lusty steppe
#

Using a parser means factoring in stuff like whether it's global too, since most pz stuff is global

#

Did tables not include a bunch of extra stuff?

thick ravine
#

Yeah. I use an AST parser.

#

luaparse

lusty steppe
#

That's the one I was thinking of 😄 Looked into it in the past

thick ravine
#

I've used it for dozens of hours.

#

It's a good lib.

lusty steppe
#

The last commit on master* is still the bug I found (but did not fix), minor pride

thick ravine
#

luaparse fails to digest pz's lua code without modifying it.

#

I have a method that fixes it.

lusty steppe
#

Dang, I was hoping it'd just happen to work with the entire source. No such luck

thick ravine
#

(PZ Lua isn't real lua & Kahlua ignores certain syntactic errors that real Lua throws on)

#

No no

#

You can

lusty steppe
#

Oh?

thick ravine
#

it loads the string for lua files and transforms it.

lusty steppe
#

What syntax errors does Kahlua ignore?

thick ravine
#

One moment.

lusty steppe
#

Ah, I had seen the long and float bit before. I didn't know about the break thing though, I wonder why luaparse can't handle that

thick ravine
#

If you read that codebase you'll find a lot of transformations & adaptation code.

thick ravine
#

I have two separate repositories to publish and Candle to upgrade.

#

I can possibly rewrite PipeWrench too.

#

If all the data I need is with simple class data provided by the docs and mapping to a filter that tells what's exposed and what isn't, Rewriting PipeWrench AND Candle to not depend on the JRE would be an insane upgrade.

#

Expect Candle to be upgraded tomorrow.

#

When that happens, I'll push it to Umbrella.

warped plover
#

vscode settings:

{
    "Lua.completion.requireSeparator": "/",
    "Lua.workspace.library": [
        "F:/SteamLibrary/steamapps/common/ProjectZomboid/media/lua"
    ]
}
#

basically get intelisense to the game lua

#

potentially add other mod in the library to get intelisense about them

#

also it seems that candle lacks Events object

thick ravine
warped plover
#

mhm

#

I guess i missed that point

languid walrus
#

it'll probably be part of umbrella

warped plover
#

What exactly is umbrella going to be?

thick ravine
#

A collation of separate projects that improves the Lua modding pipeline for project zomboid

warped plover
#

neat

#

so apparently i can download the latest version of it using this url https://github.com/demiurgeQuantified/PZEventDoc/releases/latest/download/Events.lua

#

Will include this in pzstudio

thick ravine
#

Umbrella keeps the door open for others to contribute while not stepping on other projects.

#

Albion has a fantastic solution for events.

#

Omar has wonderful and expansive utilities

#

Umbrella removes steps to operate tools such as Capsid that can easily gatekeep newcomers from benefits of the tool because of its complexity when operated.

warped plover
#

totally

thick ravine
#

I missed my alarm. Will likely code later on today.

#

This is the first time since December that I missed getting a room at a library to focus on personal projects...

thick ravine
thick ravine
#

Working on uploading PZDocs-Yaml-Compiler project.

#

Licensing as LGPL 3.0.

#

The scraper will be MIT licensed.

#

Taking a quick breather and then resuming work on the application of parameter names.

lusty steppe
#

Can Candle handle the global functions defined in LuaManager? Meant to ask that before

#

I'm starting to understand why you've expressed disdain for the Lua source before 😄 Not terrible, but stuff like

ThermoDebug = {};
ThermoDebug = ISCollapsableWindow:derive("ThermoDebug");

is certainly a little annoying

#

Nonetheless, very initial version of unnamed lua doc thing is working

thick ravine
#

So I do a nifty thing by caching the rendered code for each entity.

#

I go through those and remove GlobalObject. and it makes the function global.

#

I delegate the render code as a task via CandleRenderAdapter.

#

The codebase for Candle is pretty straightforward ATM.

#

Also, if you want to do this to code outside of PZ, Candle can do that easily with modifications to the class bag.

#

Everything underneath Candle.java and CandleClassBag.java has nothing to do with PZ.

thick ravine
#

Found a bug in Candle.

#

Fixing it..

#

Correction: It's a bug in the PZDocs Yaml stuff.

#

Cool. That's done.

#

I can make support for generics in the future.

thick ravine
#

Today is a bug-hunting day.

#

Found another for the Yaml stuff. Not storing multiple of the same method name.

thick ravine
#

Fixed.

#
getDefinition("zombie.Lua.LuaManager$GlobalObject").getMethod("triggerEvent", String.class)

YamlMethod{name='triggerEvent', modifiers=[public, static], parameters=[com.asledgehammer.candle.yamldoc.YamlParameter@23355c58], returnType='void', returnNotes='null', notes='null', deprecated=false}

#
YamlMethod{name='triggerEvent', modifiers=[public, static], parameters=[YamlParameter{name='event', type='String', notes='null', deprecated=false}], returnType='void', returnNotes='null', notes='null', deprecated=false}
#

@languid walrus

languid walrus
#

nice!

thick ravine
#

I can now attempt to grab the names of parameters for constructors and methods.

#

Also, PZDocs-Yaml has a few bugs fixed.

#

I'm fully parsing my own Yaml stuff now.

#

Pulling inside of candle.

#

Big moment.. Writing injects right now.

#
--- @public
--- @param weapon HandWeapon
--- @param wielder IsoGameCharacter
--- @param bIgnoreDamage boolean
--- @param damage float
--- @param bRemote boolean
--- @return void
function IsoPlayer:hitConsequences(weapon, wielder, bIgnoreDamage, damage, bRemote) end

--- @public
--- @param dir IsoDirections
--- @param bTest boolean
--- @return boolean
function IsoPlayer:hopFence(dir, bTest) end
#

There's a bug introduced that's causing some classes to not render for Candle however there's lua files with param names.

languid walrus
#

let's goooo

thick ravine
#

Fixed the bug.

#

This also looks nice:

--- @public
--- @static
--- @param event String
--- @return void
--- @overload fun(event: String, param: Object)
--- @overload fun(event: String, param: Object, param2: Object)
--- @overload fun(event: String, param: Object, param2: Object, param3: Object)
--- @overload fun(event: String, param: Object, param2: Object, param3: Object, param4: Object)
function triggerEvent(event) end
#

Got rid of the redundant @rough sleet and @arctic owl

#

...

#

wtf

#

Why would that even ping someone if I didn't enter in a user when the prompt opened up....

#

Awesome..

#

People catching strays.

#

Constructors are not showing up param names atm.

#

Fixed.

#
--- @public
--- @param width int
--- @param height int
--- @return IsoCell
function IsoCell.new(width, height) end
thick ravine
#

Fixed issue where param names are reserved words in Lua.

#
--- @public
--- @static
--- @param __in InputStream
--- @return int
function IsoWorld.readInt(__in) end

--- @public
--- @static
--- @param __in InputStream
--- @return String
function IsoWorld.readString(__in) end
#

See how I added Candle as a submodule,.

#

git submodule add https://github.com/asledgehammer/Candle.git Candle

#

also the file .gitmodule at the root folder.

#

@lusty steppe As well.

#

You can add your GitHub repositories or Git links using this feature.

#

When someone clicks on it via the website there it'll forward you to the repo page.

languid walrus
#

ohh, very handy

thick ravine
#

I'm going to take a break from coding although I'm totally capable of responding to messages.

#

Been at it for 10ish hours without a break.

#

I've got a logo to make for Umbrella.

#

I'll work on that sometime soon.

#

The code for generating is up although the instructions to set up those code bases to run aren't noted down just yet.

#

@lusty steppe @languid walrus Do you want me to add a repo for you and get it done now?

lusty steppe
#

Haven't pushed anything quite yet; I'll add it once I've had a chance to freshen it up a bit & make sure everything looks good

thick ravine
#

Okay sounds good.

languid walrus
#

i'll add events in a bit

thick ravine
#

sounds good.

#

@languid walrus One huge thing that we could do is use the dataset generated from the JavaDocs and do multiple language support options for people.

warped plover
#

@thick ravine great fixes

thick ravine
#

Thanks.

warped plover
#

reworking pzstudio to keep a more natural structure

thick ravine
#

Candle already feels feature-complete.

#

I might take a look at adding in generics back into the Yaml tomorrow.

#

If I do this then PipeWrench is ready for a rewrite.

#

I'm grabbing some food and then relaxing for a bit.

#

Productive day.

languid walrus
#

just added events

#

i was a little afraid git would do something weird but thankfully it played nice

lusty steppe
#

I'm still unsure how I want to handle the strange closure-based constructor pattern that is very rarely used

#
.new function in ISPriorityTable
.new function in ISMoveableSpriteProps
.new function in ISThumpableSpriteProps
.new function in ISMenuContext
.new function in ISMenuContextBuild
.new function in ISMenuContextInventory
.new function in ISMenuContextWorld
.new function in ISMenuElement

In these, in particular

#

Other than that my side of things is nearly there. May improve it to emit source instead of annotations where appropriate so that, for example, definition tables (like ZomboidGlobals, Professions) reflect the values they were defined with

languid walrus
#

oh i hate when they do it like that

lusty steppe
#

Yeah, it's an odd choice

#

I'm thinking I'll have to define an extra X__instance class based on the function body which is a bit annoying for an edge case, but it is what it is

thick ravine
#

All good.

#

We all made incredible progress today.

thick ravine
#

We'll need to write out a tutorial and explain what Umbrella is.

#

I'm guessing this will fall on my lap.

#

I actually don't know the optimal environment for EmmyLua and PZ modding.

#

I also recall EmmyLua support for VSCode.

#

I might need help with writing out the setup process.

lusty steppe
#

I only know the answer from the lua-language-server perspective, so I can help in that area

thick ravine
#

Awesome. Thanks.

#

Working on my Yaml to smartly split params with generics data.

lusty steppe
#

Also, I took a look at Candle a bit ago and saw two areas of potential improvement:

  • LuaClosure should probably be aliased to function
  • Some doc params that are present in the javadoc are arg0, arg1, etc. still—potentially some javadoc quirk that the HTML cleaning isn't picking up
lusty steppe
thick ravine
#

The 2nd bullet is likely Candle exposing more than it should.

#

I can write a Yaml Schema if needed.

#

That info will be very very useful.

#

The 2nd bullet also isn't a big issue.

#

If we can get the main thrust of parameter names then we're way ahead.

#

People can figure out the rest.

#

It could be improved yeah.

#

I see a solid 95+% population of param names.

lusty steppe
#

Yeah, definitely a large majority. Gonna be v handy

thick ravine
#

IMO way ahead of what Capsid did.

lusty steppe
#

Definitely

thick ravine
#

We have:

  • An active coder
  • A simple codebase with some documentation
  • APIs built to simplify & expand the project
#

You don't need to decompile the game to use the tool.

#

Huge W

thick ravine
#
{ param: ' Iterable subStates', full: ' Iterable<State> subStates' }
{ param: 'List frames', full: 'List<Keyframe> frames' }
{
  param: ' ArrayList targetsProne',
  full: ' ArrayList<HitInfo> targetsProne'
}
{ param: 'HashMap map', full: 'HashMap<String,String> map' }
{
  param: ' ArrayList params',
  full: ' ArrayList<TextureCombinerShaderParam> params'
}
#

Already smartly parsing param data.

#
function splitParameters(
    paramString: string,
): Array<{ param: string; full: string }> {
    paramString = paramString
        .replace('(', '')
        .replace(')', '')
        .replaceAll('\n', '').trim();

    const params: Array<{ param: string; full: string }> = [];

    let genericIndent = 0;
    let current = { param: '', full: '' };

    for (const char of paramString) {
        // (Generics counter block)
        if (char === '<') {
            genericIndent++;
            current.full += char;
            continue;
        } else if (char === '>') {
            genericIndent--;
            current.full += char;
            continue;
        }

        // (Only split params if not inside of a Generics block)
        if (char === ',' && genericIndent === 0) {
            params.push(current);
            if(current.full !== current.param) {
                console.log(current);
            }
            current = { param: '', full: '' };
            continue;
        }

        // (Add to basic param if not in Generics block)
        if (genericIndent === 0) current.param += char;

        current.full += char;
    }

    return params;
}
languid walrus
#

i'm thinking of moving the event docs to yaml too

#

never actually worked with the format before, looks super nice

thick ravine
#

So I've come to the conclusion that this Yaml dataset is actually a full-blown "Rosetta Stone" for PZ.

languid walrus
#

LOL

thick ravine
#

It just opened the door to some wild things. Let me explain.

#

I can rewrite PipeWrench with full features in less than a week with this, compared to the several months it took me.

#

Other language support is possible.

#

We can also have third-party documentation overloading the Yaml provided. This opens the door for third-party Documentation, in any spoken language.

#

We could have a Russian dataset provided by their PZ modding community that gives documentation in Russian.

#

They could modify the param names too.

languid walrus
#

oh that's great

thick ravine
#

That's a fucking huge deal.

#

So because of this, I'm currently addressing the Yaml schema.

#

Next, I'll build an editor that allows for this to be easily done.

#

These tools would undeniably help modders in an unprecedented way.

#

I'll need to provide a compiled exposer map to filter the yaml or simply provide it separately.

#

I may rename the Yaml schema based on its new-found potential.

#

The schema is still a WIP and will change.

#

I'm writing API for it so this will help. (I guess)

#

I'll provide an unsigned integer value for version control.

lusty steppe
#

Heck yeah, translated docs sounds very cool

#

Addressed the weird constructors like this:

---@meta

---@class ISPriorityTable
ISPriorityTable = {}


---@return ISPriorityTable_Instance
function ISPriorityTable.new() end

---@class ISPriorityTable_Instance
local ISPriorityTable_Instance = {}

---@return any
function ISPriorityTable_Instance.setDefaultZvalue(_z) end
---@return any
function ISPriorityTable_Instance.add(_k, _v, _z) end
---@return any
function ISPriorityTable_Instance.get(_k) end
---@return any
function ISPriorityTable_Instance.getIndex(_index) end
---@return any
function ISPriorityTable_Instance.remove(_k) end
---@return any
function ISPriorityTable_Instance.removeIndex(_index) end
---@return any
function ISPriorityTable_Instance.size() end
---@return any
function ISPriorityTable_Instance.toString() end
---@return any
function ISPriorityTable_Instance.indexIterator() end
---@return any
function ISPriorityTable_Instance.keyIterator() end
#

I was initially going to do X__instance or _X__instance but it looks ugly & this applies to so few classes in the Lua idt it really matters

thick ravine
#

Yeah as long as it works.

#

I'm working on my yaml generator from the JavaDocs.

#

Doing QOL improvements already.

#

Grabbing generics for things.

#

Not sure if annotations really matters at this point.

#

I do grab @deprecated

#

I don't mind my initial schema to be scrutinized and I actually want that.

#

It needs to work and be optimized for the uses defined above.

thick ravine
#
fields:
  - name: factions
    modifiers:
      - public
      - static
    return:
      type: ArrayList
      generic: ArrayList<Faction>
#

A better design.

#

Just noticed a bug with the Yaml set.

#

Generic classes are mangled with names.

#

Working on the fix.

lusty steppe
#

Gotta love working with HTML

thick ravine
#

It's the smallest problem to have.

#

=)

#

(Also explains some missing arg param names)

lusty steppe
#

Added the stubs to Umbrella. Only tweak I have left in mind is better typing for the ProceduralDistributions table, but I'll wait on the YAML schema to figure out how I want that to look

#

Generation code will probably not be published until next weekend

thick ravine
#

So the cool thing is that you can pull submodules vicariously through Umbrella.

#

It checks the commit head.

#

=)

lusty steppe
#

How do you pull them in? I noticed it pulled in my project after I added the submodule

thick ravine
#

You pull for Umbrella.

lusty steppe
#

I had to use git submodule update for it to grab the other ones

thick ravine
#

Oh?

#

Hmm

#

batch / sh file time?

#

There should be a way to pull all at once

lusty steppe
#

Before that they were present in the directory but without their files

#

Well, the submodules were present in vscode—the actual directories were not yes they were

thick ravine
#

git clone --recursive git submodule update --init --recursive git pull --recurse-submodules

#

so git pull --recurse-submodules

lusty steppe
#

Second one is what I ended up using, good to know. Should include that in the instructions if we don't create a GitHub release for it

#

Or either way, really

thick ravine
#

Yup.

#

@warped plover You can properly pull from Umbrella now.

#

We've put our stuff in as submodules so pull them properly.

warped plover
#

oh wow

thick ravine
#

Working on bugs on my stuff.

#

Good job @lusty steppe

#

As expected, great work and in good timing.

#

Glad I can focus on other tasks.

warped plover
#

crazy job guys

thick ravine
#

I think it was a great decision between all three of us to group up and solve this issue together.

#

Ah that stinks

#

Was giving a link to the #github-feed channel on my server but I can DM it

#

I can make a text channel for Umbrella on my Discord server.

#

That should be useful for people who pop in who might need assistance or have questions.

warped plover
#

Updated pzstudio

warped plover
#

@languid walrus Events are overwritten

#

by the deprecated one

languid walrus
#

hmm, might be a difference in behaviour between vsc and intellij?

#

i'll remove the deprecated file for now, it's not really all that useful anyway

warped plover
#

Are those events even used still?

languid walrus
#

no - i included them because they technically still exist, but they are not used at all

warped plover
#

otherwise you can just add them in the same documents

#

unless those have the same names

languid walrus
#

it was my preference to keep them in separate files because intellij's emmylua plugin doesn't mark deprecation like vscode does, but the generator does have an option to have them in the same document

warped plover
#

when i remove the deprecated one i dont get the intelisense for the other one

#

i restarted lua in vscode still

#

so strange

#

Candle and Lua works

languid walrus
#

yeah, on my end the deprecated events file is getting ignored

lusty steppe
#

There appears to be a bug in the event generation

#
Events.AcceptedFactionInvite.AcceptedFactionInvite = {
    ---@param func fun(factionName:String,username:String):any
    Add = function(func) end,
    ---@param func function
    Remove = function(func) end,
}
languid walrus
#

ohh yeah

#

ohh fuck i know how that got in

lusty steppe
#

If you mark them both with a ---@class annotation I think it will use both definitions, also

languid walrus
#

i love pushing untested changes

#

i actually don't understand how it happened because the code causing that bug should just be outright crashing from what i can see but it is what it is

#

i would love to generate the fixed files and push but windows has now decided that it cannot find python ded

thick ravine
#

Something's gone wrong and is haunting Candle's generated code.

#

I'm going to sleep on it.

#

Really annoyed though.

#

Letting yall know that the issue is methods with same param counts aren't generating as overloads.

#

So some random flip-flopping is going on with the sorter.

#

I just did a string compare on same-param count method sorting.

#

The issue still remains that overloads aren't generating where they should for those situations.

#

I also had a deep logic error in the chain from Yaml dataset to Candle which took some debugging to get fixed.

#

If you run into the issue know I'm working on it.

thick ravine
#

I'll likely be working on revision of the method render design.

lusty steppe
#

Thoughts on whether the ---@field [any] any annot should be present on Lua annotations? I included it to avoid strict field checking in case a user purposefully adds a field/the generator misses something, but leaving it off could help avoid typos & such

#

Example:

---@class ISReloadableWeapon : ISReloadable
---@field defaultAmmo any
---@field [any] any
ISReloadableWeapon = ISReloadable:derive("ISReloadableWeapon")
thick ravine
lusty steppe
#

That's the current behavior. Idt anything would break (in the type stubs, anyway) and at least on the vs code side it can be disabled via diagnostic settings anyhow

thick ravine
#

Hmm ok. I wouldn't know the optimal solution to that.

#

I need time to sort out the same method name with different return types.

#

I'll probably do what I did with PiprWrench which was OR-joining them.

#

Work time.

#

Will touch grass and Candle code later.

thick ravine
#

(Screams in development)

thick ravine
#

@languid walrus My generation of the Events class won't conflict with your stuff right?

thick ravine
#

Leaving work in a few.

#

I'll be heading to a cafe to improve Candle.

#

@lusty steppe I know you need the Yaml schema. I'll work on that when I'm done fixing what problems I see with Candle.

thick ravine
#

Okay.. Battlestations time.

#

The cafe closes early tonight.

languid walrus
#

as long as the class isn't literally called Events, no

thick ravine
lusty steppe
thick ravine
#

Yeah no worries.

#

I'm in full battle-mode with this project.

#

I work really really fast when I go full in.

thick ravine
#

So I played games yesterday.

#

Like a good modder should.

#

=)

thick ravine
#

Been combing and investigating my Candle generator codebase for why it isn't adding methods with identical names & param counts.

#

Once that's sorted I believe Candle is safe for human consumption.

thick ravine
#

Runtime logic errors are the worst.

#

=)

thick ravine
#

I did make slight progress in figuring out why some of those methods aren't showing up in Candle.

#

I'm also somewhat relieved that Candle had a deep logic error in method propagation.

#

It means that whatever bugs aren't more elusive than can be analyzed and fixed.

#

PipeWrench had several of these when handling generics.

#

I had to spend several weeks on some of those.

#

I'd rather spend a few days than weeks.

#

There was one bug that wasn't my code that was a problem however I quickly found it and was lucky to.

#

SnakeYaml interprets a value of 'on' as boolean not string, causing params named 'on' being called 'true'.

lusty steppe
#

I briefly forgot about the adjective/adverbial senses of "on" meaning "active" and was confused as to why on Earth that would be the case

thick ravine
#

I believe it to be a bug and not an over-engineered feature. only true and false should be interpreted as string literal equivalents.

lusty steppe
#

It's certainly a strange choice

thick ravine
#

This is improper for string interop

#

Logically sound, programmatically improper or frowned on (At least I frown on that)

#

I'm already dealing with reserved words in translation as a step so snakeyaml adding to this could've made me spent a lot of time chasing down what is IMO a bad take on string interpretation.

#
const RESERVED_FUNCTION_NAMES = ['toString', 'valueOf'];
const RESERVED_WORDS = [
    'and',
    'break',
    'do',
    'else',
    'elseif',
    'end',
    'false',
    'for',
    'function',
    'if',
    'in',
    'local',
    'nil',
    'not',
    'or',
    'repeat',
    'return',
    'then',
    'true',
    'until',
    'while',

    // NOTE: This is a technical issue involving 'snakeyaml' interpreting
    //       this as a BOOLEAN not a STRING value.
    'on',
    'off',
    'yes',
    'no',
];
#

I added 'yes' and 'no' pre-emptively.

#

I'm not going to deal with SnakeYaml when I don't know what they're up to.

lusty steppe
#

I was curious so I looked into it a little & this actually is (or, more appropriately, was) a YAML problem and not a SnakeYaml problem, apparently: https://yaml.org/type/bool.html

thick ravine
#

Yaml is still superior to JSON here.

#

I strongly believe that using Yaml over Json was the right choice.

#

I can easily export to Json if ever needed.

lusty steppe
#

It's certainly nicer to look at

#

I was thinking I'll support both on my end since it'll just end up being an object in the end anyhow

thick ravine
#

I'd like to force conformity to Yaml though.

#

Manual editing Yaml is way better than Json.. Plus you'd be able to comment.

#

We're not using jsonx

lusty steppe
#

Yeah, I'd rather not use a format that's not as supported

thick ravine
#

Do what you want.

#

It's not a big deal to go off and use Json.

#

The tools I'll make will use Yaml.

#

It's not hard to translate between them.

lusty steppe
#

Only in the interest of allowing user choice 😄 Yeah exactly, it'll work the same

thick ravine
#

Choices can hurt them too.

#

I watch people melt when trying to install VSCode.

lusty steppe
#

Of course, but in this case idt it's a bad thing

#

Not with how I'm thinking of supporting it anyhow

thick ravine
#

Yeah no worries.

#

SO I chose Yaml because I thought about how we could use this as a way to submit our documentation over the devs documentation.

#

Editing Yaml is way easier and I can make a software solution for this as well.

#

Incredibly simple.

#

I have to market this ability hard when we push Umbrella to the modding community

#

It's such a powerful opportunity to set things right with documentation.

#

@lusty steppe What sounds better for a name for the Yaml project: Rosetta or AnnotatedMap?

lusty steppe
#

If we were to lean more into the translation benefit as its primary goal then I think Rosetta would make more sense. I think that depends entirely on its adoption, though—I have no doubt that modders will make great use of it, but whether or not modders whose primary language is not English will take the time to create their own translations is less certain

#

Not that that was your reasoning for the name, it's just the association it gives me

thick ravine
#

Well Umbrella is more like Rosetta for exposing the function of the API.

#

Yaml is more like Rosetta for that very alt-language support potential for reading the API.

#

We could also build support for proxy functions or proxy calls that could be named something foreign as well.

#

That's a feature that could be built at some point if desired.

#

Again.. This is fucking insane.

#

The control gained by the modding community with these tools is stupid crazy.

#

Makes PipeWrench look like a Fisherprice toy.

#

I'll look at building an Electron application with bootstrap.

#

I'm thinking about disassociating the path of the yml file with the class.

#

Might move to IDs.

#

It'll make custom typings / documentation possible.

#
--- @public
--- @static
--- @param val float
--- @param min float
--- @param max float
--- @return float
--- @overload fun(val: int, min: int, max: int): int
--- @overload fun(val: long, min: long, max: long): long
function PZMath.clamp(val, min, max) end
#

This is the current result.

#

This looks proper.

#

EmmyLua really lets me write simple overloading without type-joining.

#

@lusty steppe I believe Candle is ready.

#

It's obvious that there's more than what's actually exposed in Candle right now however it isn't that much so it should be fine for now.

lusty steppe
#

Nice 😄

thick ravine
#

Fixed a few other issues after that.

#

I'll add the actual documentation text render code soonish.

thick ravine
#

@lusty steppe

--- @public
--- @static
---
---  Almost Identity Imagine you don't want to modify a signal unless it's drops to
---  or close to it, in which case you want to replace the value with a small
---  constant. Then, rather than clamping the value and introduce a discontinuity,
---  can smoothly blend the signal into the desired clipped value. So, let m be the
---  (anything above m stays unchanged), and n the value things will take when the
---  is zero. Then, the following function does the soft clipping (in a cubic
---  https://iquilezles.org/www/articles/functions/functions.htm
---
--- @param x float value in [0..1]
--- @param m float
--- @param n float
--- @return float value in [0..1]
function PZMath.almostIdentity(x, m, n) end

--- @public
--- @static
---
---  Almost Unit Identity This is a near-identiy function that maps the unit
---  into itself. It is the cousin of smoothstep(), in that it maps 0 to 0, 1 to 1,
---  has a 0 derivative at the origin, just like smoothstep. However, instead of
---  a 0 derivative at 1, it has a derivative of 1 at that point. It's equivalent to
---  Almost Identiy above with n=0 and m=1. Since it's a cubic just like
---  it is very fast to evaluate.
---
--- @param x float value in [0..1]
--- @return float value in [0..1]
function PZMath.almostUnitIdentity(x) end
#

Okay. Adding this to constructors and then fields.

#

Then classes.

#

So a problem with translation is EmmyLua is limited to method signatures with the same name to show different documentation.

#

We're going to need to go with the first-defined method that renders which is the simplist. =/

#

Going to be a silly rule but yeah.

#

Limitations suck.

thick ravine
lusty steppe
#

Because of documenting the additional parameters, or documenting other behavior?

#

Ah

thick ravine
#

=)

lusty steppe
#

Actually, I revoke that ah

thick ravine
#

=(

lusty steppe
#

😄

#

I'm unsure what you mean by problematic

#

Do you mean problematic in terms of pulling documentation from the javadoc?

thick ravine
#

If a method very similar to the host method in Emmy annotations has documentation it can't be expressed.

#

Pulling is fine.

#

Applying is the issue.

lusty steppe
#

Ah yeah, that's what I meant. Makes sense

thick ravine
#

We can use a priority flag as a solution if need-be.

#

I don't think it'll be a big deal right now since no one is writing their own docs.

lusty steppe
#

Glad this isn't something I have to worry about from the Lua side 😄

thick ravine
#

Just found and fixed a bug in my docs scraper.

#

Involved field documentation blocks not fully extracting due to link DOM elements.

#

Okay so that leaves classes to be documented.

#

Almost there..

#

Okay. Updated Umbrella to latest commit head for Candle.

#
git submodule update --remote
git add .
git commit -m "Git Submodule Update"
git push origin main
#

Okay @languid walrus @lusty steppe I'm logging off for a bit. Candle looks ready. If your works are ready as well, we can begin the installation and usage documentation stuff.

#

@warped plover

warped plover
#

Nice

#

Gonna test now

lusty steppe
#

Mine is usable, but I'd like to improve it further so I wouldn't say ready. Like I said though, there likely won't be any progress on it until the weekend

thick ravine
#

So now candle is solid.

thick ravine
#

😃

#

I've got to stop my habit of writing commit messages in past-tense.

thick ravine
#

@lusty steppe I still want to try to write a resolver for type literals for Lua params, fields, etc.

#

I was writing a Lua to Typescript transpiler earlier this year. This is the next step.

lusty steppe
#

I'm unsure whether I understand; does this mean being able to infer those types from usage?

thick ravine
#

Usage or reference.

#

Everything can be traced back to a literal expression.

lusty steppe
#

I was thinking something similar 😄 I put that one in the "maybe, but unlikely" bucket though, since I only have so much time to put towards this

thick ravine
#
function foo(bar)
  print(bar);
end

foo(1);
#

1 is a numeric literal expression.

#

I know that I'm calling foo in this context.

#
function foo(bar)
  print(bar);
end

foo(1);
foo('bar');
#
--- @param foo: number | string
function foo(bar)
  print(bar);
end

foo(1);
foo('bar');
#

Using an AST parser, you can link calls to their respective destinations. Create a reference chain.

#

All undead code has a chain leading back to the literal expression or calculated literal value.

#

My plan was to walk through parsed Lua code and build these relationships / references into chains and walk back to resolve types.

lusty steppe
#

That'd certainly be handy

thick ravine
#

It was what I planned in order to improve PipeWrench's Lua typings.

#

Clarify all event parameters and add them as references in this graph / chain / tree.

#

Then run through the Lua code.

lusty steppe
#

Something that would potentially be difficult to capture depending on how the vanilla Lua uses functions: optional parameters

#

Analysis of the function body could help in that regard

#

I'm thinking of those callback functions that pass param1, param2, param3, param4 (which I find unfortunate and wish it were just ..., but that's a separate rant)

lusty steppe
#

Few Candle things I noticed from opening some of my mod folders to check smth:

  • __globals.lua file is missing ---@meta annotation
  • The global functions that have a different name than their java function name use the java function name; instof should be instanceof, for example
  • addSound global is missing. Lua method has the same name as Java function so not too sure why that would be happening
  • We could probably add a class field to every class; other solutions didn't do this but it's present & would avoid needing to suppress a diagnostic
  • overloads that don't specify self don't seem to work properly, at least in vscode. That is, the following annotation produces diagnostic about argument count for a call with 4 args
--- @public
--- @param other Color
--- @return Color
--- @overload fun(r: float, g: float, b: float): Color
--- @overload fun(r: float, g: float, b: float, a: float): Color
function Color:set(other) end
#

For the class field, I'm referring to the use with __classmetatables, which also could be declared (but maybe that part is something that belongs in the Kahlua stub)

thick ravine
lusty steppe
#

They're not necessarily unused

#

Those params tend to be only stored and then passed back to callback functions (any examples I can think of, anyhow)

thick ravine
#

Then they're being used and aren't dead code.

lusty steppe
#

Mhm

#

What I meant by the optional parameters bit was that your provided example could be inaccurate for something that isn't actually required, but isn't passed without that parameter in the vanilla code

thick ravine
#

Yeah.

#

Class isn't needed.

#

It's for debug mode which.. yeah.

#

I mean I could.

lusty steppe
#

That's not what I'm referring to, one moment

thick ravine
#

I know why we'd want it.

lusty steppe
#

local _ChatBase = __classmetatables[ChatBase.class].__index

#

For the purpose of overrides

thick ravine
#

My brain. It hurts. Why would you do this?

#

lol

lusty steppe
#

For the purpose of overrides lol

thick ravine
#

You can override a Java class from Lua?

lusty steppe
#

It'll only use the override Lua-side, but yeah

thick ravine
#

The absolute fuck?

#

I didn't know about this.

lusty steppe
#
local _ChatMessage = __classmetatables[ChatMessage.class].__index

--- ...excluding details

---Override to modify chat format.
---Decorates the original getTextWithPrefix.
---@return string
function _ChatMessage:getTextWithPrefix()
    local info = processTransforms(self)
    if type(info) == 'string' then
        return info
    end

    -- rebuild the string with the desired format
    return concat {
        utils.toChatColor(info.formatOptions.color),
        '<SIZE:', info.formatOptions.font or 'medium', '> ',
        info.timestamp or '',
        info.tag or '',
        utils.interpolate(info.format, info.substitutions),
    }
end
#

Excerpt from chat mod I have yet to release

thick ravine
#

And this works without debug mode set to true?

lusty steppe
#

Yup, I've used it on a server with friends

thick ravine
#

You can shadow class methods in Lua.

#

That sounds like a possible security vulnerability lol.

lusty steppe
#

How so?

thick ravine
#

A shadowed method being rerouted with vanilla calls from Lua without knowing could create anomalous situations that could trigger something undesirable and potentially lead to instability.

lusty steppe
#

The same argument could be made for overwriting globals

#

I wouldn't say it's inherently a vulnerability—I see what you're saying but idt it's a concern

thick ravine
#

It's one of the things I'd look for as a malicious actor.

#

That's fine. Not here to discuss it at length. =P

#

(Security brain)

#

So I'll need to check for Lua annotations in GlobalObject. I did this for PipeWrench buttttt forgot to do it for Candle. Good catch.

#

Also @meta and I don't even know what the damn thing does.

lusty steppe
#

It's not all that important really, but if you ctrl + click on a global there's an explosion of diagnostics bc it applies them (and there are a lot of missing returns, of course, because it's a stub)

#

In VSCode anyway

thick ravine
#

Oh so it's for that version of Emmy.

lusty steppe
#

Yeah, idt non-LuaCATS even has the meta annotation

thick ravine
#

So a few small things.

#

--- @field class any?

#

Is this what you need per class?

lusty steppe
#

Yes, I think that'd do it

thick ravine
#

Okay. Doing this now.

#

I want this to be ready when your stuff is.

lusty steppe
#

Likely this weekend; I noticed one issue at the same time that I saw that stuff, but aside from that I think all I have left are enhancements for the generation code

#

Well, that and the ability to inject documentation

thick ravine
#

Get it to the point where you can generate using GitHub Actions and you're golden.

#

This is my target.

lusty steppe
#

It already accepts command line args for input & output so that's probably doable today

thick ravine
#

I'm going to need to learn GitHub Actions.

#

Someone helped me set up auto-compilation for PipeWrench. =)

#

They used public Steam API to download PZ and run my super secret code. =D

lusty steppe
#

Oh nice

thick ravine
#

It might be good for me to run the exposer classes into a compiled list of exposed classes, fields, and functions.

#

Combine this with The Rosetta Yaml and any transpiler to Lua can be used and rapidly deployed.

#

I'd like to get people as far away from executing Java as possible.

lusty steppe
#

Fair, although I don't think this'll stop people from decompiling for a deeper understanding (nor should it 😄)

thick ravine
#

In this context yes I do but not generally.

thick ravine
#

I'm not sure if specifying a type in overload functions works however it shows up in IntelliSense via IntelliJ IDEA.

#

I also don't know why addSound isn't there.

#

Ohhhhhhhhhh

#

I know why

#

fixed

#

Everything except the last bullet regarding overloads is fixed & implemented.

#

@lusty steppe Fixes are pushed and also updated on Umbrella.

#

You got your silly class field.

thick ravine
#

Anything else, @lusty steppe ?

lusty steppe
#

Couldn't tell ya, aside from the last bullet point. I only looked at the warnings for 2 of my own mods

#

The __classmetatables bit can go in the kahlua stub, other than that nothing else I saw

thick ravine
#

Hmm ok.

#

How would it be defined to work?

languid walrus
#

feels like it would make more sense for candle to do that since it's already parsing all the exposed classes

lusty steppe
#

I was thinking __classmetatables could just be defined as a global table; a more accurate typing would need the class fields to have a type to use for the key type

thick ravine
#

If you can write it out here, I can add it.

#

I don't know anything about that setup.

lusty steppe
#

I think just a table would suffice, but @languid walrus may have a better idea?

languid walrus
#

no you're right, if we were to add keys for each class then we'd probably have to actually map out the metatables

lusty steppe
#

In that case, if we want it to be in Candle, it should work as just __classmetatables = {}

languid walrus
#

at which point it could just be in the kahlua stub again

thick ravine
#

We can make a new lua file called __kahlua.lua

lusty steppe
#

I was gonna rename my kahlua stub to that to fit with that standard lol, yeah I'll just include it in there

thick ravine
#
--- @class __classmetatables
__classmetatables = {}

Correct?

#

Okay.

#

Your utilities are more technical.

#

I'm simply mapping the Java side.

lusty steppe
#

Technically the kahlua stub contains stuff coming from the Java side and the Lua side, but I don't think anyone will care unless they're competing for the position of ultimate pedant

thick ravine
#

I'm working with you not competing with you so this is good for your project.

#

=)

lusty steppe
#

I was referring to a hypothetical end user lol

thick ravine
#

Ah ok.

#

I want the best for the modding community and the work we have now already far-surpasses anything else on the market in quality.

#

It's actually out-competing PipeWrench, my very own Typescript transpiler project.

thick ravine
#

I like using underscores because in file lists, and tree views they're all together.

#

It's a categorical sorting and signifier thing with me.

#

Also Lua uses this for their internal API so it simply works.

#

Python 3 oddly enough uses this as well.

lusty steppe
#

I thought the intent was to try to avoid potential future collisions with vanilla files, but now that I've typed that out I realize with Candle's file structure that wouldn't happen anyway

thick ravine
#

These are habits that I've adopted over my 15 years' of coding.

languid walrus
#

to me it's just an indicator that this file does not execute

lusty steppe
#

Three benefits wrapped in one dunder

thick ravine
#

I may write a Python adapter implementation in Candle.

#

I may also write an exported Yaml file that serves as an exposer map.

lusty steppe
#

“Python to Lua? Who would want to—”

All variable declarations automatically become local in the output, which if outside any expression, will be equivalent to a global.

Alright I'm sold

thick ravine
#

I'm doing it for testing purposes for strengthening the Yaml schema for the doc stuff and exploring how fast it would be for me to implement this using Candle.

#

Apart from the __*.lua files, Candle renders everything through an implemented RenderAdapter.

lusty steppe
#

Neat, I like it. I've yet to clean up the annotation part of my generation code, might model it to be similar to that

thick ravine
#

I can merge a lot of the constructor-method code but otherwise it's set.

#

I'm not in a cleaning phase so it'll be fine for now.

#

If you have a donation link and want to put it on Umbrella I am 100000% okay with that.

languid walrus
#

i've been meaning to clean up my tool

#

especially with the md output, that's a separate tool with mostly copy pasted code - was meant to be a proof of concept but never went back to it

thick ravine
#

This is the 2nd attempt at making a logo for Umbrella.

#

I may use the cane part for Candle.

#

Ah yes.. All the symbolisms..

#

WDYT @languid walrus @lusty steppe . Are you okay with this being Umbrella's logo?

languid walrus
#

looks good to me!

lusty steppe
#

Same here, I like it

thick ravine
#

Okay cool.

#

That's going to be the logo then.

thick ravine
warped plover
thick ravine
#

@languid walrus Is there anything else you think could help modders with Umbrella?

languid walrus
#

nothing has come to mind yet

#

i've been thinking about something to map out the sandboxvars table like events, but that would probably have to be an ide extension to be useful

thick ravine
#

Yeah very likely so.

#

The .txt files?

#

They can use the ZedScript extension for some help.

languid walrus
#

yeah, it'd include the vanilla ones too but they aren't commonly used by modders so automatically generating them would be most important

thick ravine
#

Same highlighting format.

languid walrus
#

yeah, that might be something to add to the zedscript extension if i get around to working on it

thick ravine
#

I paused development on it to focus on other stuff.

#

(Like Candle)

#

Will clean that codebase when I resume work on it.

thick ravine
#

I'm going to add a couple channels for discussion / support for candle & umbrella in my server.

languid walrus
#

hehe got event stubs updating with a github action

#

i haven't got it doing that automatically yet, it should probably lint them + maybe check if they've actually changed before i risk that

#

but it's still a huge time saver

thick ravine
thick ravine
#

@languid walrus I'm thinking about taking your events dataset and writing a compiler project for it so I can compile it to TypeScript too.

#

Oh yeah so it's all manually put into Lua.

languid walrus
#

manually?

thick ravine
#

Did you type Events.lua?

languid walrus
#

no

thick ravine
#

Where's the dataset?

languid walrus
thick ravine
#

Ah a JSON file.

#

This is what I was looking for.

languid walrus
#

i recently rewrote it around the groundwork for multiple output format support so depending on how the typescript for that would look it could be added

thick ravine
#

Useful tool to bookmark.

#

lol 1400 lines vs 1900

languid walrus
#

hmm it could work

#

the main thing that concerns me is the imports

thick ravine
#

Having the full path of the type fixes that.

languid walrus
#

if we did that then yeah it would fit pretty well with the structure i just set up

thick ravine
#

Actually I forgot that I simplified imports for PipeWrench using a proxy import.

#

You need the class names.

#

You'd manually copy this code into the result file:

  /**
   * EventEmitter is for both vanilla ProjectZomboid event handling and custom events written for PipeWrench.
   *
   * @author Jab
   * @param L The type of {@link EventListener} associated with the Lua-event.
   */
  export class EventEmitter<L> {
    /** The Lua-event ID. */
    readonly id: string;
    /** @param id The Lua-event ID. */
    constructor(id: string);
    /** @param listener The listener to register. */
    addListener(listener: L): void;
    /** @param listener The listener to unregister. */
    removeListener(listener: L): void;
    /** @param params Any parameter to pass. */
    trigger(...params: any): void;
  }
#

This is the heart.

#

This is what it fires:

local EventEmitter = ____exports.EventEmitter
EventEmitter.name = "EventEmitter"
function EventEmitter.prototype.____constructor(self, id)
    self.id = id
    if not Events[id] then
        LuaEventManager.AddEvent(id)
    end
end
function EventEmitter.prototype.addListener(self, listener)
    addEventListener(self.id, listener)
end
function EventEmitter.prototype.removeListener(self, listener)
    removeEventListener(self.id, listener)
end
function EventEmitter.prototype.trigger(self, ...)
    triggerEvent(self.id, ...)
end
languid walrus
#

it already supports prefixing the file (for comments and the meta annotation) so it should be fine to insert that

thick ravine
#

Gotta love my interfaces with vanilla PZ code.

#

I might rewrite PipeWrench's Java typings generator in Candle.

thick ravine
#

@languid walrus My boss likes our project's logo.

#

=)

languid walrus
#

hell yeah

thick ravine
#

How's it going?

lusty steppe
#

Likely working on this later today; focusing on other stuff at the moment

thick ravine
#

Take as much time as you need.

thick ravine
#

Any updates from yesterday?

lusty steppe
#

Nothing from yesterday, but I'm working on it right now. Kind of turning into a rewrite bc I'm rethinking how I did it

thick ravine
#

Do you have a stable version of your first write that is usable for a first release of Umbrella?

lusty steppe
#

The stubs are available on the repo, but the SandboxVars one isn't representative of what's produced since I made it how I intend for it to be. If you mean the code that produces them, no but I can do that & save improving it for later

#

It's a bit of a challenge for me to accept the version of something that's not exactly how it is in my head or at least close—that's why I've released very few mods (only one, actually) 😄

thick ravine
#

Hmm okay. Is it possible to make it how you'd think it'd be ok for a release?

#

I get that optimization feeling.

#

I call it "Cleaning as I Cook".

#

I do my own micro-rewrites to keep myself from spiraling down the ladder of optimization hell.

lusty steppe
#

Yeah, I feel you. I think it's technically okay now, it's just the SandboxVars one that has me annoyed

#

It's the only thing that qualifies as being a class that uses the return value from another module: SandboxVars = require 'Sandbox/Survival'. I was going to rewrite it to try to resolve it

thick ravine
#

All good.

lusty steppe
#

I've decided to just not emit a class for SandboxVars for now, but still emit the original require so it'll still offer Intellisense. Better solution will come later

#

I'm still seeing the issue with the diagnostic for overloads with self from Candle's stubs; unsure whether you were going to address that

#

I tried it out in IntelliJ and found that the way the plugin handles overloads for name hints is inconsistent, but it doesn't have diagnostics so it's not a problem for that version

thick ravine
lusty steppe
#

I was just typing up a contrived example, but I'll just show the actual one instead

thick ravine
#

Ok.

#

It should help me understand the problem.

lusty steppe
#

Where newColor is a Color: newColor:set(red / 255, green / 255, blue / 255, 1.0). Produces the diagnostic: This function expects a maximum of 4 argument(s) but instead it is receiving 5., because the self argument isn't in the overload for set:

--- @public
--- @param other Color
--- @return Color
--- @overload fun(r: float, g: float, b: float): Color
--- @overload fun(r: float, g: float, b: float, a: float): Color
function Color:set(other) end
thick ravine
#

So the solution? add self param?

#
function Color:set(self, other) end
#

Do overloads need it?

lusty steppe
#

It'd have to be added to the overloads, yeah. The only concern is that it may make the parameter name hints in IntelliJ's EmmyLua look off

languid walrus
#

emmylua does have diagnostics, they're just off by default

lusty steppe
#

Oh, I didn't see them anywhere. Lemme see what they say

#

I have not used this plugin and have no idea where to turn the diagnostics on 😄

languid walrus
#

it's buried

thick ravine
#

Okay well I don't know exactly what's needed or what's the optimal design.

#

=/

lusty steppe
#

I'm not sure either without seeing the diagnostics in IntelliJ's EmmyLua

#

This issue didn't exist with the annotations produced by pz-zdoc, but I think that's because it emitted a copy of the function for every overload

#

e.g.,

---@public
---@param arg0 Color
---@return Color
---@overload fun(arg0:float, arg1:float, arg2:float)
---@overload fun(arg0:float, arg1:float, arg2:float, arg3:float)
function Color:set(arg0) end

---@public
---@param arg0 float
---@param arg1 float
---@param arg2 float
---@return Color
function Color:set(arg0, arg1, arg2) end

---@public
---@param arg0 float
---@param arg1 float
---@param arg2 float
---@param arg3 float
---@return Color
function Color:set(arg0, arg1, arg2, arg3) end

I don't think that's ideal, though

thick ravine
#

It looks very redundant. =/

lusty steppe
#

Agreed

lusty steppe
#

Forgot to update when I did it, but initial gen code is at https://github.com/omarkmu/PZLuaStubGen. I'd still like to rewrite it at some point to analyze dependencies in a better way + be better in general, but if we just want an initial release that'll generate the Lua stubs as they are now

thick ravine
#

We might share whatever solution works first on that.

#

@languid walrus Do you have any special way to optimally setup a PZ Lua mod environment with EmmyLua?

languid walrus
#

at this point, i just throw in umbrella and the game source

thick ravine
#

I'd like to go ahead and write the instructions.

#

I'm still also not sure if it's required to add that self thing to Candle.

lusty steppe
#

I haven't tested it thoroughly with IntelliJ but it seems to be divergent behavior exclusive to lua-language-server. I don't know whether it's severe enough to warrant waiting to release, but it will certainly produce diagnostics for valid code

thick ravine
#

My issue is that I'm distancing from modding, so I am trying to wrap this up to be good enough to release.

#

So I'll do what I need to get Candle at 100%.

thick ravine
#

EmmyLua acting different on vscode is a issue in general.

lusty steppe
#

It's a fork which no longer has the aim of being fully backwards-compatible with EmmyLua

#

For most basic purposes it is, but when generics are implemented fully that'll be a significant difference

#

I see this as more of an issue with EmmyLua than LuaCATS though, tbh. I didn't get to see the diagnostics, but it has strange behavior for how overloads are interpreted depending on whether a function is declared/called with the colon syntax. LuaCATS, on the other hand, seems to interpret the first argument in both cases as the actual first argument

thick ravine
#

Or it could be rewritten entirely lol

#

I would be that guy lol

lusty steppe
thick ravine
#

I keep seeing this.

#

lol

lusty steppe
#

I think it's the xkcd I send the most (so I wouldn't be surprised to find out I've sent it to you before lol)

thick ravine
#

@languid walrus @lusty steppe The README.MD is up.

#

Add your donations / community links where you see fit.

lusty steppe
#

I'd just fix it myself if I were home, but the heading at the top is missing a b

thick ravine
#

Oh.

lusty steppe
#

Other than that, looks good. I think we could include more detail on how to use them per IDE & maybe provide releases for that

thick ravine
#

Yeah. I don't know that yet.

#

Was why I asked yesterday.

lusty steppe
#

Can always be added in the future

thick ravine
#

Yeah.

#

At least I hyperlinked the items.

#

Typ0 fixed.

thick ravine
#

I'm not getting instance functions in IDEA's EmmyLua plugin.

#

Not sure why.

#

I do however see them in VSCode's extension.

lusty steppe
#

That's just how both plugins handle functions

#

I think the only way around that would be a separate instance type, unless there's some way I don't know about

languid walrus
#

i'm not sure sure i understand what's missing

thick ravine
#

I might recommend the vscode extension more.

#

The IDEA plugin is very vague on settings.

languid walrus
#

the vscode extension is better, it's just in an ide i like less

thick ravine
#

Also in Manderin.

languid walrus
thick ravine
#

I just tried this haha

#

It didn't work.

#

Might need to reload the project.

languid walrus
#

i saw there was an emmylua idea fork that seemed more similiar in function to luacats, but i haven't gotten around to trying it out yet

thick ravine
#

I'm avoiding all of those forks for now.

#

Heheh.

#

Going for the most universal support.

languid walrus
#

yeah, i'm just praying for 'works better and doesn't require us to do anything'

thick ravine
#

Heheh.

lusty steppe
#

I just realized I misread the instance functions thing above

thick ravine
#

I could make a Umbrella-Template just like PipeWrench has a template so people can use it quicker.

#

They'll still need to install the EmmyLua extension.

languid walrus
#

what would be the difference? it seemed as drag and drop as you could make it already

thick ravine
#

A template can be in a node environment and provide more tools.

#

Also for vscode a json file is needed for emmylua

#

A template gives way for opportunities to further improve the modding experience.

#

We could make umbrella a npmjs dependency even.

#

That's more effort than I'm willing to put in.

#

Okay so

#

Beyond bug fixes I think this is good for you to do what you want with it.

#

If I disappear, you have 100% of what is needed to update Candle.

languid walrus
#

my place should be easily filled too

thick ravine
#

It'll be a huge disappointment for the community to not gather the willpower to simply run the code that is publicly available in my absence.

#

Now we'll need to advertise the heck out of Umbrella so people know of it.

languid walrus
#

you'll need to replace my submodule if i vanish from the scene but there's nothing irreplaceable

thick ravine
lusty steppe
thick ravine
lusty steppe
#

Are you using one called “EmmyLua”?

thick ravine
#

(Possibly optional)

#

Yes

lusty steppe
#

The lua-language-server is “Lua”, I believe

#

I think the other one is a port of the IDEA one. Lemme check the readme

languid walrus
#

that's correct

#

it's actually a bit worse than intellij emmylua, which is already the inferior plugin imo

lusty steppe
thick ravine
#

Yeah I don't know what the right answer is to recommend for people.

lusty steppe
#

If you liked umbrella, you'll love car car (I expanded them after seeing this, just gave me a laugh)

thick ravine
#

😮‍💨

lusty steppe
#

I'd say the Lua one is better to recommend, idt people really use the EmmyLua one

thick ravine
lusty steppe
#

I haven't done a survey to back up that claim, of course, just speaking based on what I've heard + own experiences

thick ravine
lusty steppe
#

You're telling me it's not car car

languid walrus
#

well just the public install counts should say enough

lusty steppe
#

True, I didn't think to check those

thick ravine
#

If you can edit the readme.md on Umbrella to support the better extension please do.

languid walrus
#

lua language server is by far the dominant lua plugin

#

dominant enough to not even give itself a consistent name u_u

thick ravine
#

If I can get help on this front that'd be great.

#

I'm not the expert here.

#

This isn't my turf. =/

lusty steppe
#

I'll update it later today if no one else has—at work atm

thick ravine
#

Same.

#

I snuck in this work at work.

#

I like how the candle logo turned out.

languid walrus
#

i haven't used vscode in over a year so i'm not a good candidate to write usage instructions for it

#

i prefer my jetbrains ides where possible

thick ravine
#

Fixed the spacing in my candle logo

thick ravine
#

Now I can get away with hating on Lua because then I could be like "Well this is a thing."

#

xD

languid walrus
#

all we have left to blame is lua itself

thick ravine
#

And I'm slowly continuing to take away everything that can be blamed.

#

lol

#

Now if we can convince people to use module exports, we'd be in business.

#

I'd personally want to eliminate global use of Lua in PZ.

#

In my ideal world, the only things touching global are pho-namespacing and primitive utilities that are missing in Kahlua.

languid walrus
#

big agree

thick ravine
#

Kids are learning that the standard is the code PZ has.

#

That's terrifying.

#

ZedScript is just as screwed up.

#

The coding climate here is still very unacceptable by my standards.

languid walrus
#

i think i'm possibly *the* most lua positive pz modder but i have to say that making global the default and local a special keyword is a ridiculous blunder

thick ravine
languid walrus
#

what i mean is you won't really see me hating on lua, i think it's a great language

thick ravine
#

I'm strangely neutral on Lua itself.

#

What people code in PZ isn't real Lua.

#

It tries to be Lua really hard but isn't quite.

#

I'm not just barking up a tree.. I'm barking at the right branches.

#

xD

#

It'd be wasteful to simply complain without a course of action or solution.

#

That's how I feel and I hope that I've lived up to that standard.

#

x)

languid walrus
#

you absolutely have

thick ravine
#

Thanks.

languid walrus
#

@thick ravine is this something you're aware of? no parameter names for sendClientCommand or sendServerCommand

thick ravine
#

It's because I filter non-public methods in Rosetta.

#

Looking at a fix.

#

I need a drink rn lol

languid walrus
#

no rush!

thick ravine
#

Oh no I can't get one tonight haha

#

Spent my fun money on my car just to figure out what's wrong with my AC.

#

aaaaaaaaa

#

I ended up paying to find out that I have the worst AC issue. xD

#

Dead Compressor: A heroic journey through the gates of financial hell.

#

The way that Compressors work and the mechanic market is silly.

#

Anyways I know the issue here for Candle.

#

Thanks for reporting.

languid walrus
#

concerning: every single method with a KahluaTable argument seems to have this issue

thick ravine
#

Probably the same thing.

languid walrus
#

something strange seems to have happened here too

#

not really a critical issue but it seems to have happened in a few places

thick ravine
#

That's on purpose.

languid walrus
#

oh? what's the purpose?

thick ravine
#

__java.lua

#

preserves the type given even though it becomes a float in Lua.

languid walrus
#

oh, i see

thick ravine
#

It's a magic trick.

languid walrus
#

disregard then 😅

#

it's my first time actually sitting down and working on a mod since we started umbrella so i'm only seeing the quirks now

thick ravine
#

Someone literally having a problem with the method I'm figuring out.

#

Funny that.

#
--- @param module String
--- @param command String
--- @param args KahluaTable
--- @return void
--- @overload fun(player: IsoPlayer, module: String, command: String, args: KahluaTable): void
function sendServerCommand(module, command, args) end
#

Found the issue.

languid walrus
#

nice!!

thick ravine
#

Okay. Just pushed changes to Candle, Candle-Compiler and Umbrella.

#

git submodule update --remote

#

You should see the changes.

languid walrus
#

perfect, great work

#

was trying to work out why git wasn't working properly and it turned out i just needed to reload the library 😅

thick ravine
#

All good.

thick ravine
#

Hoping things are in working order.

languid walrus
#

i haven't run into any issues

thick ravine
languid walrus
#

it's been a real time saver already

thick ravine
#

That's really good to hear

#

There's a lot of potential still to tap into.

thick ravine
#

@lusty steppe Possible need to split files based on line limits.

lusty steppe
#

Yeah, that's why I'd mentioned that file as one that should probably be replaced with a description of its type rather than the source

#

But that'll be after YAML is handled

thick ravine
#

Ah okay.

lusty steppe
#

This as a problem in pz-zdoc too; it doesn't really cause any issues other than not having Intellisense for the proceduraldistributions table, but something I intend to fix eventually anyhow

thick ravine
#

I guess that now the burden on further work is on me.

#

Yaml things.

lusty steppe
#

I can look at the existing .yaml files to figure it out, but I don't think I'll be doing any work (or at least not significant work) on this this weekend

thick ravine
#

Working on it.

thick ravine
#

I'm having a stupid amount of trouble getting Yaml schema validation working in vscode so I'm working on a JSON Schema.

lusty steppe
#

Nice

thick ravine
#

Added Lua schema definitions.

#

Also events with callback as lamda properties.

#

I should turn methods back to an array because multiple entries with the same name.

thick ravine
#

I have at least something of a schema to work on.

#

There will be a second schema for third party documentation.

thick ravine
#

Rewrote Rosetta for a JSON format.

#

Working on a couple things involving generics and then pushing those changes and rewriting my Candle's adapter of Rosetta API.

#

Generics data will have a full type string and when I decide to code this, a nested breakdown of generic types.

#

That data will be used when I rewrite pipewrench.

#

The schema is basically complete. (Apart from descriptions)

#

@lusty steppe This has schema definitions for Lua. @languid walrus This has schema definitions for events.

#

A separate repo is now available to get the schema as a raw link

thick ravine
#

Uploaded JSON and YAML variants.

thick ravine
#

I think that we'll need to expand on the lua schema for Rosetta.

thick ravine
#

It's cool to see my JSON Schemas working for both YAML and JSON renders.

thick ravine
#

I see a couple of concerning renders for the new Rosetta API for Candle but it is rendering stuff.

thick ravine
#

Hahaha

#

@languid walrus I just realized that the issue I'm having is due to the differences within one version of the game.

languid walrus
#

oh?

thick ravine
#

The JavaDocs = 41.77

languid walrus
#

oh that's right

thick ravine
#

They added a boolean flag to serverConnect(...)

#

I was like.. where was this guy at?

#

So I spent around 25 minutes looking.

#

I could do a dirty search

#

Ehh nah

#

That'd create some problems.

#

Not the end of the world.

thick ravine
#

Will need to spend time performing fixes to the new Rosetta model but am taking a break.

thick ravine
#

I'm taking this brief moment of time to investigate issues with my rewrite of Rosetta.

thick ravine
#

Fixed the biggest issue with Rosetta.

thick ravine
#

@languid walrus @lusty steppe @warped plover Everything's up to date.

#

Fixes are applied.

#

New Rosetta API and typings in both YAML and JSON formats.

languid walrus
#

🥳

thick ravine
#

A lot of non-named args were fixed from the last, most stable render of Candle.

#

@languid walrus Do you have your own JSON Schema file?

languid walrus
#

for events? yeah

#

although i'm starting to wonder if i used the word schema correctly when i named it 😅

#

i have a file called schema that defines all the events

thick ravine
#

Hmm I think you misunderstood what a schema is in the JSON context specifically.

#

Yeah.

#

So let me link you to Rosetta's schema

#

What you did was a dataset that might follow a schematic pattern but you did not write an actual JSON schema, which is ok.

#

This schema instructs an IDE to validate the implemented JSON file with the schema.

#

The IDE should then alert the user of type errors, missing data, unknown data, etc.

languid walrus
#

ohh that's useful

thick ravine
#

I validated all Rosetta using this schema.

#

So this file has a prototype schema design for events. I could conform to your design just fine.

#

My goal is to get us all on a standard.

#

When this happens, I can write that third-party documenter application so people could add their documentation to Umbrella.

#

This can also allow for future support for mods doing their own typings.

#

That'd be down the road but the door's open now.

#

The ball for moving forward for the Umbrella project is no longer in my court ATM. =)

#

I did a full rewrite for most of my code and brought forward a schema to improve to suit yours and Omar's works.

#

Okay. Going silent for a bit. Hope y'all have what you need for the moment.

warped plover
#

Nice man great work

thick ravine
#

Everything good?

thick ravine
#

Just looked into it. It's possible to write python support for PZ.

#

This wouldn't immediately work but:

class Event:
    def __init__(self) -> None:
        pass

    @staticmethod
    def Add(callback) -> None:
        pass
    
    @staticmethod
    def Remove(callback) -> None:
        pass

class Events:
    pass

Events.OnGameBoot = Event()
import Events

def callback():
    print("Test")

Events.OnGameBoot.Add(callback)
local Events = require "Events"
local function callback()
    print("Test")
end
Events.OnGameBoot.Add(callback)
languid walrus
#

yeah i've actually been thinking about it

#

i probably wouldn't even use it, i just think it'd be fun

thick ravine
#

My issue is knowing how to setup the right environment for such a mod

#

Using pip3, etc.

#

This is another puzzle and solving it would likely be a lot of fun.

#

@cold ruin

#

It'd be about translating common tasks in Python to Kahlua

#

This project has a lua translation utility file

#

It's cool that I already have somewhat of a decent result.