Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Distribute your source code in bytecode — Gideros Forum

Distribute your source code in bytecode

OZAppsOZApps Guru
edited April 2012 in General questions
I have a blog post at http://howto.oz-apps.com/2012/04/make-lua-custom-libraries-secure-your.html that talks a little about lua bytecode and then how you can use Gideros, it does not work with other frameworks (Wohoo Gideros) and how you can safeguard your source code and still provide the users with something to try, best of it all, you can also create a trial version for the user to try on the simulator and then they can purchase the version for running (including testing) on the device. Have a read, and special thanks to Atilim for a lot of his support on many of the technical things.

Likes: gorkem, GregBUG, atilim

twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
+1 -1 (+3 / -0 )Share on Facebook

Comments

  • atilimatilim Maintainer
    edited April 2012
    Hi OZApps, thank you for this great article :)

    Also I can explain another trick to understand if the system is 32 or 64-bit, so you can selectively load your code:

    1. Create an empty function and dump its bytecode with the function string.dump:
    local f = string.dump(function()end)
    print(f:byte(1, #f))
    (http://pgl.yoyo.org/luai/i/string.dump)

    2. On a 32-bit machine the result is:
    27 76 117 97 81 0 1 4 4 4 8 0 10 0 0 0 64 109 97 105 110 46 108 117 97 0 1 0 0 0 1 0 0 0 0 0 0 2 1 0 0 0 30 0 128 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0

    And on a 64-bit machine the result is:
    27 76 117 97 81 0 1 4 8 4 8 0 10 0 0 0 0 0 0 0 64 109 97 105 110 46 108 117 97 0 132 0 0 0 132 0 0 0 0 0 0 2 1 0 0 0 30 0 128 0 0 0 0 0 0 0 0 0 1 0 0 0 132 0 0 0 0 0 0 0 0 0 0 0

    Here the 9th byte tells you the size of size_t so that you can understand whether your architecture is 32 or 64 bit. And here is a simple usage:
    local function is32bit()
        return string.dump(is32bit):byte(9) == 4
    end
     
    if is32bit() then
        require("mylib-32")
    else
        require("mylib-64")
    end

    Likes: GregBUG

    +1 -1 (+1 / -0 )Share on Facebook
  • many many thanks @OZApps and @atilim for this!!!!
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • I had some info on the same at http://howto.oz-apps.com/2012/04/lua-riff-source-code-and-bytecode.html in case any one is interested.

    And to reiterate what Atilim had mentioned earlier, the mobile devices will run the 32 bit versions only.

    Likes: atilim

    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.