New API Docs website

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
Muppet9010
Fast Inserter
Fast Inserter
Posts: 231
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Re: New API Docs website

Post by Muppet9010 »

The process that a mod makes a request via the API (either function or to get/set a field) would be helpful. I got the below answer via Discord from Bilka that all LuaObject instances returned to my mod from the API have 0 field data. So for UPS optimised mods we should really be caching every field's value where possible when reused for lowest UPS cost. Especially important when on_tick events are being used.
Bilka:
Every single thing you access on a LuaObject is given to you upon request, nothing comes with the original object
I had assumed that the simple value fields (ints, strings) where coming back with the LuaObject and it was only references to other LuaObjects that were obtained on access.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3545
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: New API Docs website

Post by DaveMcW »

On LuaTransportLine and probably other pages, the index() and length() operators are not defined properly.
operator length :: uint [R] Get the number of items on this transport line.
operator index :: LuaItemStack [R] The indexing operator.
Compare to the old API:
operator # :: uint [R] Get the number of items on this transport line.
operator [] :: LuaItemStack [R] The indexing operator.

Hornwitser
Fast Inserter
Fast Inserter
Posts: 154
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Re: New API Docs website

Post by Hornwitser »

I made a video to demonstrate just how badly the new site design performs on my phone compared to the old one, and with the box shadows removed.

https://youtu.be/xjCwI-8wy2g

This is also how the main site, blog, and mod portal performs on my phone. In my opinion it's not a great look for a game that touts as being highly optimized to have a site design this slugging. And again, you can get these fancy looking borders without performing like a dumpster fire using border images instead of abusing box shadows.

curiosity
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: New API Docs website

Post by curiosity »

So, today the way to obtain a link to method/property from its entry has changed from a neat link on the name itself to a pretentiousfancy little chain icon. Can we have the old one back? Nothing prevents having both.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3545
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: New API Docs website

Post by DaveMcW »

curiosity wrote:
Thu Jan 13, 2022 8:08 pm
So, today the way to obtain a link to method/property from its entry has changed from a neat link on the name itself to a pretentiousfancy little chain icon. Can we have the old one back? Nothing prevents having both.
The name in the method list at the top of the page is still a link and works like it always does. The chain icon at the bottom of the page is just a bonus.

The confusing part is that the name+link at the top of the page is the same color as the name+description at the bottom of the page, but only one of them is clickable.

curiosity
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: New API Docs website

Post by curiosity »

DaveMcW wrote:
Fri Jan 14, 2022 12:41 am
The name in the method list at the top of the page is still a link and works like it always does. The chain icon at the bottom of the page is just a bonus.

The confusing part is that the name+link at the top of the page is the same color as the name+description at the bottom of the page, but only one of them is clickable.
But you have to scroll to the top. What I mean is the name "at the bottom of the page", as you put it, was also a link and now isn't.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5009
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: New API Docs website

Post by Klonan »

curiosity wrote:
Thu Jan 13, 2022 8:08 pm
Nothing prevents having both.
I was having a problem with it, often you want to copy-paste exact names of variables and events, and when it was a link it would keep jumping the page around instead of letting me select it and copy

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1236
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: New API Docs website

Post by ptx0 »

Klonan wrote:
Fri Jan 14, 2022 6:00 pm
curiosity wrote:
Thu Jan 13, 2022 8:08 pm
Nothing prevents having both.
I was having a problem with it, often you want to copy-paste exact names of variables and events, and when it was a link it would keep jumping the page around instead of letting me select it and copy
so put a little clipboard icon and copy it when you click THAT.
My Mods - Fish Per Minute base size metric - Use your crashed spaceship as a belt balancer?
• • •
Base: Bob's @ 1 Million SPM
• • •
Linear search and overflows are indicative of sloppy coding practices.

curiosity
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: New API Docs website

Post by curiosity »

Klonan wrote:
Fri Jan 14, 2022 6:00 pm
I was having a problem with it, often you want to copy-paste exact names of variables and events, and when it was a link it would keep jumping the page around instead of letting me select it and copy
That's a good point, though in my experience links only cause issue when you want to select in the middle of them. Shouldn't matter when selecting the entire link text.

coderpatsy
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Tue Apr 17, 2018 11:45 pm
Contact:

Re: New API Docs website

Post by coderpatsy »

Klonan wrote:
Fri Jan 14, 2022 6:00 pm
curiosity wrote:
Thu Jan 13, 2022 8:08 pm
Nothing prevents having both.
I was having a problem with it, often you want to copy-paste exact names of variables and events, and when it was a link it would keep jumping the page around instead of letting me select it and copy
I find browser extensions like Copy Link or Copy Link Text to be invaluable. Also, holding alt will allow you to select text without following links (or sending JS events for that click at all I think). I'm not arguing to change the site back, just saying.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1149
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: New API Docs website

Post by Pi-C »

coderpatsy wrote:
Sat Jan 15, 2022 7:40 am
I find browser extensions like Copy Link or Copy Link Text to be invaluable.
Thanks for the hint, I've just installed Copy Link Text! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5009
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: New API Docs website

Post by Klonan »

coderpatsy wrote:
Sat Jan 15, 2022 7:40 am
hout following links (or sending JS events for that click at all I think).
Invaluable tip! Thank you! Actually I have this problem quite frequently and this will optimize my time
(They say perfection is just doing a lot of little things right)

Post Reply

Return to “Modding discussion”