Reading documentation

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Reading documentation

Post by ernpchan » Tue Sep 01, 2015 2:02 am

One thing that I always struggle with sdk documentation is that the documentation seems to assume a certain level of information that a noob probably doesn't have. So unless you know where to look you spend a lot of timing hunting and hoping.

I'm trying to get all the layers in my file and via the MohoDoc class I can see that it's done via CountLayers.

What's slowed me down is that I initially tried

Code: Select all

moho.mohodoc:CountLayers() 
and that didn't work. Only through searching online did I find this script
http://users.on.net/~alexical/Anime%20S ... render.lua

That then shows that it should be

Code: Select all

moho.document:CountLayers()
My question is how would I know it should be .document? I showed our resident TD the documentation as he's very knowledgeable in reading sdk documentation and knowing where to look for things and even he admits he doesn't see how one would know this based on the documentation.

I've dealt with programs that have excellent documentation and others that make you wanna throw your monitor through a window. So far the ASP looks to be on the better side of the spectrum. So I can't tell if this is just me not knowing how to read the documentation or the documentation not being as complete as it should be.
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Reading documentation

Post by synthsin75 » Tue Sep 01, 2015 2:32 am

Look at the native tools in AS. Most of us learned the basics by using those as an example.
hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Reading documentation

Post by hayasidist » Tue Sep 01, 2015 6:47 pm

@ernpchan - yeah - the documentation from SM on scripting is pretty limited. IMO they're missing a trick by putting scripting out of reach of many by keeping things, ...er... less than clear. IMO, with this approach they're shutting off a stream of free tech support / enhancement work whose value, again IMO, would far exceed the investment of dev team effort needed to make the documentation both up to date and more user-friendly... [/moan]

Your confusion over data type (MohoDoc) and item names (moho.document) is, it could be argued, more to do with knowing LUA than knowing the API - but, IMO, the documentation doesn't exactly help matters by using "template" variable names that are confusingly similar to Class names.

But your point is well made and I've made an update or two to the ASLua site - in MohoDoc and in CountLayers() -- http://www.aslua.com/index.php?show=met ... ers&id=718 which I hope will start to shed light on things for you and your colleagues.
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Reading documentation

Post by ernpchan » Tue Sep 01, 2015 6:58 pm

Thanks hayasidist,

I'm totally open to being called out that this is just me not knowing lua well enough as yes, I don't know lua that we'll. :mrgreen:

One upside of learning the sdk of a program is it's like learning how to ride a bike. Once you know the ins and outs it becomes second nature. Just not sure if me crashing into the ground is user error or bicycle failure.

Oh and if you find a possible bug in the sdk, wow that's a fun experience... :shock:
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
Post Reply