lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

suppose one have this string of letters:

    abcdefghijklmnopqstuvxyz

in an array (table) and want to perform these steps:

    1. shift the string by a certain amount of characters cyclic

    abcderfghijklmnopqstuvxyz => ghijklmnopqstuvxyzabcderf

    2. take off a character at a certain position

    ghijklmnopqstuvxyzabcderf +> g ijklmnopqstuvxyzabcderf
                                  h
    3. shift again 

    ghijklmnop qstuvxyzabcderf

    4. insert letter at free position

    ghijklmnophqstuvxyzabcderf


How can I do these steps in lua most efficiently?

Thank you very much in advance for any help!

Best reagards,
mcc