Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Allen, Lua Library for strings — Gideros Forum

Allen, Lua Library for strings

Roland_YRoland_Y Member
edited July 2012 in Code snippets
Allen is a Lua library which provides a set of utilities and helpers for strings operations. Allen can be considered as an extension of the built-in Lua string library.
Allen's API was heavily inspired by the Javascript library Underscore.string.

Link: https://github.com/Yonaba/Allen
«1

Comments

  • Hi,

    Can the link (and the other library Moses) be added to the wiki or relevant area @atilim, @gorkem
  • gorkemgorkem Maintainer
    @zakkwylde666 Added both, thanks for heads up
  • ______ Member
    @gorkem, is there any chance of including such helpful libraries (and maybe more, curated set of libraries) with Gideros?

    These libraries may be useful to a good number of Gideros users.

    Currently everyone needs to manually download/copy/paste into each project, and keep track of the latest versions to update them.
    People call me "underscore".
  • gorkemgorkem Maintainer
    When we thought about it with Atilim, we were stuck with the issue of updating. If an update comes, how do we easily know this, and merge it in the upstream?

    Some may think that it's just a helper library/utility, so it doesnt update very frequently and it's ok to update all in 6 months of time frames (I'm also inclined to think like that).

    So if someone takes the lead, collect all Lua helpers/utilities in Wiki, we can always include it in the distribution (@atilim probably wants to comment here too). I can also do that, but I'm not very sure where to look at those. The "curated" set is here, we know where they are, but how about other libraries scattered around?
  • ______ Member
    edited July 2012
    Hmm. How often is a release of Gideros released?

    I'd suggest this:

    Setup a repo in http://github.com/gideros, for helper libraries that are to be included in core.

    The community can help with suggesting adding new libraries, and sending pull requests for updates.

    You can assign someone to make decisions whether a library goes in or not.

    And when the time to release an update comes, just pull the current versions of the libraries from that repo.

    And if you don't have the time to manage the repo, maybe someone from this community could help?
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    For example some Github pro maniac with underscores instead of username? :)
  • ______ Member
    Create a script which pings download urls of all the scripts, and see if they were modified, and store the last update time :)
    People call me "underscore".
  • ______ Member
    Hey @Roland_Y, can we use both Allen and Moses in a single project? How would I require them? Will I have to merge the 2 returned collection of functions into one "_" manually?
    People call me "underscore".
  • NascodeNascode Guru
    edited July 2012
    I agree with @___ :p

    I am not used to Github (I am Bitbucket+Hg guy anyway) but it should possible to add people to create their repo (or fork) under Gideros right? Something like what Marmalade guys do https://github.com/marmalade

    Oh and @gorkem and @atilim i think Gideros community is increasing in size with many talented devs coming. Maybe there's way for us to help you more? Is there any list of things that needs helping hands from community to you?

    Likes: ar2rsawseen

    have fun with our games~
    http://www.nightspade.com
    +1 -1 (+1 / -0 )Share on Facebook
  • ______ Member
    edited July 2012
    Ok, this is what I'm doing right now. Suggestions welcome.
    _ = require 'vendor/Allen'
    for k, v in pairs(require 'vendor/Moses') do _[k] = v end
    Edit: This will definitely break functions like import.
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    Really maybe there's some tasks that could be handled by community instead of @atilim and @gorkem waisting their time on?
  • Roland_YRoland_Y Member
    edited July 2012
    Ok, this is what I'm doing right now. Suggestions welcome.
    _ = require 'vendor/Allen'
    for k, v in pairs(require 'vendor/Moses') do _[k] = v end
    Edit: This will definitely break functions like import.
    I do not recommend doing that.
    Fact is, when I started working on this, I wanted to merge those helpers (Moses and Allen). But, when it started to grow, I made them distinct, as their purposes were different (strings for Allen, tables for Moses).
    Though they may not be conflicting issues with function names clashing, I won't mix them.
    Handle them into different variables, or mix them with string and table libraries.
    require ('vendor.Allen').import()
    local _ = require 'vendor.Moses'
    local fn = _.functions()
    _.each(fn,function(i,functionName)
       table[functionName] = _[functionName]
    end)
     
    -- Test
    print(string.capitalize('Hello'))
    print(table.detect({1,2,3},3))
    Well, thanks for using this helper. Hope it fits your needs.
  • gorkemgorkem Maintainer
    @nascode @___ @ar2rsawseen It'd be perfect that you could manage, update and finalize the list of "Gideros Community Libraries" - and we can include it with the release. Mr. Underscore's suggestions are very reasonable, and doable, however someone should take the lead and start maintaining these libs, and I'm pretty sure it's not a burden but fun. :)

    If you want, we can discuss it on IRC some time (better during evening near UTC timezone like 21:00 PM UTC, or similar) ?

    Or, someone can come up and say "dont make things hard with IRC, it's dead simple, here's the Github entry, here's the Wiki entry, so come add your library here" - I'd be more than happy heh :)
  • ______ Member
    @Roland_Y Why don't you have an import function in Moses, like you have in Allen? We could simply do .import() on both, and get going?
    People call me "underscore".
  • ______ Member
    @gorkem Don't make things hard with IRC, it's dead simple, here's the Github page to create a new repo, select Owner: Gideros, Name: gideros-community-libraries (and enable wiki?) and post a link here :D
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2012
    I think @gorkem meant creating own repo and wiki by yourself :)
    Can ownership be shared?
  • ______ Member
    You can add as many commiters as you want. And wiki can be made editable by anyone.

    A central repo would be better than 10 of us creating separate repos.
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    So as Github pro can you create central repo and assign commiters or/and create a script which pings download urls of all the scripts, and see if they were modified, and store the last update time

    I would prepare list of all Gideros related projects which are available on Github and contact other authors to place their contributions on Github and assist them.

  • ______ Member
    I can make a single file with list of projects, and a bash file which loops through them, downloads them into /vendor/. If they were modified, you'd see them in the git status. Just commit them, and push.

    @gorkem etc can just visit the repo before release, pull projects, and put them into Gideros

    How about that @ar2rsawseen?

    You do have cygwin or something to run bash on Windows 7, right?
    People call me "underscore".
  • ______ Member
    Or I can do Ruby/Python instead of Bash.

    Let me know which one would be best for others. Ruby is best for me :)
    People call me "underscore".
  • @Roland_Y Why don't you have an import function in Moses, like you have in Allen? We could simply do .import() on both, and get going?
    That will be for the next commit. Thanks pointing that out.
  • ______ Member
    @Roland_Y Great, looking forward to it :)
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    Hmm Redmine which is used at bugs.giderosmobile.com is based on Ruby, so Gideros hosting can use Ruby.
    @gorkem can updater script created by @___ be hosted on Gideros hosting and added to cronjob?

    If not we'll look into other options ;)
  • gorkemgorkem Maintainer
    Repository is here:

    https://github.com/gorkem-cetin/gideros-community-libs/

    Feel free to send me your username and I'll add there.
  • gorkemgorkem Maintainer
    @___ I'm more comfortable with bash scripts but anything will do of course.
  • ______ Member
    @gorkem

    I'm writing a small Ruby script for this.

    A libraries.yml file (yaml because it's the cleanest format for this thing)
    A script which will fetch all the libraries declared in the yml file into vendor/

    And if anyone cares about it, I'll create a pretty auto generated list of the libraries present, and make it available on my username.github.com url.

    Your views?
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    which I doubt will be ___.github.com :D
  • ______ Member
    Bah, I'll use bash. Ruby has problems with https requests, always.
    which I doubt will be ___.github.com :D
    They don't allow that :(

    People call me "underscore".
  • Repository is here:

    https://github.com/gorkem-cetin/gideros-community-libs/

    Feel free to send me your username and I'll add there.
    Yonaba

  • ______ Member
    edited July 2012
    How does this look?

    -

    libraries.txt contains list of libs
    run "bash fetch.sh" to fetch all the libraries
    commit and push :)

    @ar2rsawseen want to contribute?
    People call me "underscore".
Sign In or Register to comment.