~dmbaturin/soupault

6 2

Announcing Add1toCOBOL.Lua - a library for Soupault Plugins

Details
Message ID
<6c9b5fb7-4fb1-a140-57fe-a2edf839d159@aoirthoir.com>
DKIM signature
pass
Download raw message
Announcing Add1toCOBOL.Lua  - a library for Soupault Plugins

Add1toCOBOL.Lua is a third party library that provides useful plugins, 
widget settings, variables and functions for Soupault projects and 
Soupault plugins. The ADD1.Plugins demonstrate how to use the 
Add1toCOBOL.Lua library in your own plugins. The Add1toCOBOL.Lua website 
is http://add1tocobol.com/add1tocobol-lua/.

BUT if you want the FUN version of the website, to remind you of your 
1960s flower experiences you can go to: 
http://add1tocobol.com/add1tocobol-lua/fun/

  Add1toCOBOL.Lua adds the following features to Soupault (with more 
coming as I have time to make them):

ADD1.Plugins for Soupault Widgets:

     colorize-characters.lua
     colorize-elements.lua
     colorize-words.lua
     do-code.lua
     insert-all-html.lua
     tree-image-file.lua
     tree-image-src.lua
     tree-template-include.lua

ADD1.Settings for Soupault Widgets:

     action =
     elements_apply =
     images =
     plugins =
     raw =
     selectors =
     selectors_apply =
     templates =
     And Sometimes:
         file =
         html =
         luacode =

ADD1.Variables for Soupault Plugins:

     ADD1.action
     ADD1.builddir
     ADD1.elementsApply
     ADD1.imagesdir
     ADD1.pluginsdir
     ADD1.raw
     ADD1.selectors
     ADD1.selectorsCount
     ADD1.selectorsApply
     ADD1.selectorsIndex
     ADD1.sitedir
     ADD1.templatesdir
     And Sometimes:
         config.file
         config.html
         config.luacode

ADD1.Functions for Soupault Plugins:

     ADD1.create_array()
     ADD1.find_file_in_tree()
     ADD1.get_config_or_default()
     ADD1.get_config_array_or_default()
     ADD1.get_random_color()
     ADD1.get_site_directories()
     ADD1.loop_selectors()
     ADD1.loop_elements()
     ADD1.process_element()
     ADD1.set_standard_variables()
     ADD1.trim_left()
     ADD1.wrap_characters_with_tag()
     ADD1.wrap_words_with_tag()
Details
Message ID
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com>
In-Reply-To
<6c9b5fb7-4fb1-a140-57fe-a2edf839d159@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
added two new plugins: add-class.lua and add-style.lua

did some changes in the functions as well...
Daniil Baturin
Details
Message ID
<c32d4ed5-fdfc-f987-1581-a8f8543a6200@yandex.ru>
In-Reply-To
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
Wait, wow... do dofile("path/to/file.lua") can be used to load libraries?

I was under impression that it would just execute the code in that file,
but wouldn't import its functions into the scope where it was called from.

I have to admit I completely misunderstood you when you first said
you've made a library because I thought loading libraries was impossible
with current Lua-ML. It's a great discovery that it's actually possible,
and I'm sure the library will help plugin writers.

I need to walk through it and steal some ideas for additions to the
native plugin API.

I also wonder if we can add an option for loading libraries, so that
plugins don't have to read a file every time they run.
Details
Message ID
<7547e8aa-79e9-2775-9981-35c7d714ae88@aoirthoir.com>
In-Reply-To
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
If i try to do it too many layers deep it will not load...

For instance if i have library.lua with this code:

ADD1 = {}

dofile('function_one.lua')

and function_one.lua is this code

ADD1.function f1() do some code end;

well that will not work... I can RUN functions outside of that..create 
variables.. but it was weird it would not let me create a function that way.

It would be interesting to see about having a standard library that we 
could all use to do things.. and that could be just available.. any 
specific libraries tho i think you would have to do a load in the plugin 
itself ..or make sure the user did it in their soupault file.. 
technically you could do a dofile(myfile.lua) as long as it was in the 
same folder as the plugin i think...

But i think it is all a matter of making sure which ones ... that a 
plugin gets the right one.. which is just as easy as a dofile.. BUT 
let's say that this and other libraries were all integrated to the core 
soupault... or anything under plugins/libraries or libraries/.. etc... 
those could be automatically made avaiable in your code from a dofile...

which would give two options.. drop it in the library.. it gets done 
automatically..if not do your own dofile in the plugin...but that might 
be extra work for the plugin writer.. not sure.. gotta muse on it more.. 
i dont know ocaml at all so no way i can contemplate that yet..


still Lua is a great choice... in less than a week i had written several 
plugins.. and functions... refactored again and again to keep trimming 
them down.. as i mentioned  in the other post
Details
Message ID
<2ade2979-a606-9af1-5b47-f274bceef310@aoirthoir.com>
In-Reply-To
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
also steal away... i wish i was better suited to give help to the 
core... thanks for the kind words too
Details
Message ID
<be8efea4-b78d-bcd9-6c72-5cc76fc4871d@aoirthoir.com>
In-Reply-To
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com> (view parent)
DKIM signature
missing
Download raw message
This has moved to http://soupault.add1tocobol.com and 
http://soupault.add1tocobol.com/add1tocobol-lua/
Details
Message ID
<00bdfb4b-6bd6-687d-47db-39923d9205bf@aoirthoir.com>
In-Reply-To
<ad7bca1a-4dd7-efff-12ee-d9e89a2d420d@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
Ok i just changed as many of the plugins i could, which was most.. so 
instead of setting a variable code = [[ some code ]] i just converted as 
much to functions..then..

loop_selectors('yourNewFunction()') just calls the function you created 
directly in your plugin...that worked from the start but my plugins were 
all code in a code variable which made tracking bugs difficult with no 
code highlighting... yay!
Export thread (mbox)