Wiki cleanup / reorganization with new release strategy - page 3 - CHDK Releases - CHDK Forum

Wiki cleanup / reorganization with new release strategy

  • 22 Replies
  • 12846 Views
*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Wiki cleanup / reorganization with new release strategy
« Reply #20 on: 03 / March / 2012, 03:54:45 »
Advertisements
The current http://chdk.wikia.com/wiki/Lua/Lua_syntax is plenty
I second that.
This page was designed to help newcomers and uBasic scripters to dive in into the Lua language.
Just sending them to the official Lua reference without some introductive notes scares (Lua) beginners, with an article like this used as an entry portal to the Lua scripting world the first step into this area should be a bit simpler...

And - we have a nice & easy to understand sample, self-documented and also nicely coloured :D
Code: (Lua) [Select]
print("Hello CHDK !") -- this is a line with a comment at the end
...doesn't it look times better than http://www.lua.org/manual/5.1/manual.html#pdf-print ?

Code: (xml) [Select]
print (ยทยทยท)
Receives any number of arguments, and prints their values to stdout, using the tostring function to convert them to strings. print is not intended for formatted output, but only as a quick way to show a value, typically for debugging. For formatted output, use string.format.
:P



Re: Wiki cleanup / reorganization with new release strategy
« Reply #21 on: 03 / March / 2012, 06:50:41 »
IMO we should have a very brief description how does Lua/uBasic look like with a 2-3 examples, not the real documentation. Something like:

-----------------------------------------

Lua language style
  • Commands in lua have folowing syntax: command(parameters).
  • At the end of line no marker is needed (no ";" like in C, PHP, Java).
  • Block of code starts wit appropriate command and ends with 'end' keyword.
  • Comments start with -- (two 'minus' signs).

Example code in Lua:
Code: (Lua) [Select]
-- This is an example program in Lua
-- And these are two lines of comment
print("Hello World!!!")   --print a comment in console
a=1
b=3
if (a~=b) then                         -- we check here whether 1=3
    print("one it's not three")        -- it's not, so let say that
    print("huh?")
end                                    -- end of the block

-----------------------------------------

And that's enough description, maybe with more examples. Example code says much more than 1000 words. Then we should have command description in other pages, where each command should have information, whether it is accessible from uBasic or Lua only. I mean this format is good:
http://chdk.wikia.com/wiki/Script_commands_stub

This way anybody that need for example take a shoot with Lua will find this in commands stuff. Basic knowledge of the Lua (uBasic) style will be enough to write a program, that takes a shoot. And do anything you like.

I'm not a programmer, I had no idea about Lua before I met CHDK. But Google was enough to find appropriate commands (and sometimes ask on forum). I know Lua syntax not from the manual but from examples. And after not very long time I was able to write a text editor in Lua ;) So maybe brief description of the syntax with clear description of each command will be the best way?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Wiki cleanup / reorganization with new release strategy
« Reply #22 on: 03 / March / 2012, 10:10:43 »
I assume you mean Lua synatax ;)
fixed it - thanks
Quote
But personally, I feel quite strongly that we should not try document the base Lua language. The official lua documentation is more complete and correct than anything we will write. We should send users there, and concentrate on documenting those areas where CHDK differs. The current http://chdk.wikia.com/wiki/Lua/Lua_syntax is plenty, or possibly more than plenty.
I agree.  What I had in mind was a short cheat sheet showing the most common syntax.  I seem to use too many different languages and when I get to one that I haven't used for a while I usually need a review of the basics.  I'd rather not have to traverse a sea of links to get to a 400 page PDF manual if there was a cheat sheet available somewhere instead.
Quote
One difficulty here is that there is a 90% or more overlap between ubasic and lua CHDK functions. Duplicating them will significantly increase the maintenance overhead. Because of this, I'd lean to having a "script API reference" with language specifics where needed.
That can work too - the stub page that outslider started looks loke a good way to do that.

IMO we should have a very brief description how does Lua/uBasic look like with a 2-3 examples, not the real documentation.
Right now,  I'd settle for single accurate page that gives all the available functions for each language.  If it also listed the arguments for those functions and the meaning of any return values that would be even better.   

But if you want to write 2 or 3 examples of how to use each of those functions (there are a lot of them), I will not object.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal