Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Export issue in Gideros Studio on Mac OS? — Gideros Forum

Export issue in Gideros Studio on Mac OS?

PaulHPaulH Member
edited May 2017 in General questions
This is one of those "what am I doing wrong?" moments. When working on an iOS version I've always used Gideros Studio on Windows, then exported the iOS project, moved files to a Mac, and built with X-Code. Today I tried installing Gideros on the Mac to save some file transfers when troubleshooting iOS issues. Running 2017.4.1 I found that when I exported an iOS project, whether exporting assets only or a full export, the only Lua file that got exported was main.lua. All the other assets (fonts, graphics) were exported, but the other lua files were missing from the export. I tried 2017.3.1 and had the same result. For now I'm back to doing my code editing on Windows, exporting, and transferring files to the Mac. I also tried with one of the example projects, in case my issue was specific to my project, but I got the same results. I also tried with and without encrypting code files.

So... Am I missing something, or is there a bug in the Mac OS version of the studio that prevents the Mac OS version from exporting all the code files?

Paul

Comments

  • HubertRonaldHubertRonald Member
    edited May 2017
    Hi @Paul, I had the same problem when export my project to Android Studio from my iMac. If you are encrypting your files, you should exclude the files from execution (except init.lua and main.lua) y it works

    The only extra work I had was to make my classes local and call them with require when I really needed them something like this:
    local myClass = Core.class(Sprite)
     
    function myClass:init(conf) ... end
    function myClass:function_001()
    .
    .
    .
     
    return myClass
    so you can exclude from execution "myClass" and when you really need it in some lua file
    you only put:
    local myClass = require "myPathproject/.../myClass"
     
    local config={}
    config.x, config.y=... 
    local Object = myClass(config)
    .
    .
    .
    I hope it help you
  • PaulHPaulH Member
    Interesting... After making the classes local does Gideros include those lua files in the export? What I'm seeing (again, only when running Gideros Studio on a Mac) is that the lua files aren't being copied to the export folder at all, whether I select to encrypt them or not. I have several dozen lua files in a project, but the only one that shows up in the export is main.lua. I tried with the bird animation sample project, which contains main.lua and bird.lua, and when I export a project bird.lua is missing from the export.

    Paul
  • hgy29hgy29 Maintainer
    Accepted Answer
    @PaulH, all lua files marked for execution are merged into a single main.lua file, that's why you don't see them. Main.lua in just larger;)
  • PaulHPaulH Member
    Ah... Very interesting. Is that specific to the Mac version, or recent builds on all platforms?

    Likes: HubertRonald

    +1 -1 (+1 / -0 )Share on Facebook
  • keszeghkeszegh Member
    I was also wondering how come that those lua files are missing yet the project works.. now i understand.
  • HubertRonaldHubertRonald Member
    edited May 2017
    I was also wondering how come that those lua files are missing yet the project works.. now i understand.
    Me too @keszegh
    http://giderosmobile.com/forum/discussion/comment/51761#Comment_51761

    Well basically I did "local" my classes because I like to know, that there is in the project that I export (Whether the project is new or an old one that isn't very large)

    I guess it should also improve the code performance somewhat since the classes are not global (correct me if I'm wrong)

    Sorry for the late reply @PaulH I should to say: "don't appear when it is build encrypt (or not)" and not only encrypt...

    I have several dozen lua files in a project
    ...If that also asked me with an application that I have (it has more than 100000 lines of code and a lot classes) I think in this case I would only exclude files for the moment without doing local classes or gradually
  • I'm adding to this thread because I have a relating problem.

    When doing an iOS export (tried on both mac and windows) I get one main.lua in the export asset folder, just as it should be. But in my case it's only the main.lua lines and not a merged file from all the lua files in my project. Naturally, when run from xcode, my app is terminated at a early stage (in my case when macro definitions or classes aren't found).

    I've tried with Bird Animation, in that case the main.lua in export seems to be a merged file from bird.lua and main.lua (although it's encrypted even though encryption is unchecked), and it works when run from xcode.

    When exporting my own project I get a red line in the export process window:
    /Applications/Gideros Studio/Gideros Studio.app/Contents/Tools/luac: [string "..."]:2: attempt to index global 'table' (a nil value)
    Has this something to do with it?
  • Just to say, I have no issues at all exporting to .apk, Android Studio, HTML5 and Xcode for any of my projects, from Mac. I've recently dusted off some old projects and it's all been fine.

    Likes: SinisterSoft

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    @saeys, yes luac ( lua compiler) failing to compile your lua files into a single lua bytecode explains why your project isn’t exported correctly. Now I wonder why luac doesn’t manage to compile it and which part of the compiler code ever wants access a global called ‘table’.
  • SinisterSoftSinisterSoft Maintainer
    edited January 2018
    @saeys The file may look encrypted, but that's actually bytecode (your source code is converted to bytecode for the project), the encryption tick box will effectively further scramble this so that it's much harder to see what your code does. Bytecode (normally) by itself could pretty easily be reversed back to some Lua code using commonly available tools - this is a little harder for the Gidros flavour of lua though as we also have modified the bytecode to be universal and also we have extra operators that (if used) will not be reversed by tools unless they also have been modified - this will stop most people and they will give up trying to get your code. In the API help there is a section on the Lua enhancements.

    Likes: saeys

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29 said:

    Now I wonder why luac doesn’t manage to compile it and which part of the compiler code ever wants access a global called ‘table’.

    Maybe I'm on to it somehow...

    For this app update I've added a macro function inside 237 movieclips - this macro uses table functions (table.remove, table.insert etc). Works well on windows and mac players (although mac player needed a fix that came in 2018.1, related?).

    This macro function is defined in init.lua and I get no errors there (neither live or when via output). But when I move the macro function to the .lua file where it is called (the same file as the 237 movieclips), I get this error in output when doing the syntax check:

    C:/Program Files (x86)/Gideros/Tools/luac.exe: [string "..."]:2: attempt to index global 'table' (a nil value)

    I also get the same error live, on line 2. (The macro function is declared on line 12-34 and called for the first time on line 80.) The app still works well in players.

    Thus, exactly the same error as the export reports. Coincidence, or related to why my project isn't exported correctly?
  • hgy29hgy29 Maintainer
    Definitely not a coincidence. I don't really get (yet) how macro stuff is supposed to work, but it looks like the macro'ed code is somehow actually executed during parsing, or something along that. Would you be able to come up with a simplified project that fails ? I'd try to trace luac and see what happens then.
  • I'll try that!
  • saeyssaeys Member
    edited January 2018
    A macro function and a "normal" function as cut'n'pasted from my long code (have cleaned it up a bit but sorry about the crudeness anyway). This snippet runs in player without errors, but reports luac.exe: [string "..."]:2: attempt to index global 'table' (a nil value) both live, in output at syntax check and when exporting (iOS).
    vocals @ (|
      local vocalStart = table.remove(..., 1)
      local vocalEnd = table.remove(..., 2)
      local vocalTable = {}
      local vocalFold = 0
      local vocalDir = "up"
      for iv = vocalStart, vocalEnd, 1 do -- oscillate between 1 and 3
        if vocalDir == "up" then 
          vocalFold += 1
        elseif vocalDir == "down" then 
          vocalFold -= 1
        end
        if vocalFold == 3 then
          vocalDir = "down"
        elseif vocalFold == 1 then
          vocalDir = "up"
        end
        table.insert(vocalTable,"{"..iv..","..iv+1 ..", vocal["..vocalFold.."]	},\n")
      end
      return table.concat(vocalTable, "")
    |)
     
    function playB()
      anim = MovieClip.new{
        {1,  13,  PB1 },
        {14, 23,  PB2 },
        {24, 50,  PB3 },
     
        vocals(13,33)  -- start, end
      }
      playAnim()
    end
    ps. doing the pre lang="lua" thing in this post, still the ugly yellow code box, sorry about that. EDIT: Oh... :blush:
  • hgy29hgy29 Maintainer
    thanks, that will be helpful, although I am away from my computer until friday so don't expect a reply in the next two days :)

    Likes: saeys

    +1 -1 (+1 / -0 )Share on Facebook
  • That's cool, I look forward to get nearer a solution. :smile:
  • The macros are executed on parsing, so the code they produce is also then parsed.

    Likes: antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    I see, indeed, the issue is that luac doesn't load standard lua libraries such as table,os,io, etc. I've added them, hope it doesn't break something else.

    Likes: saeys

    +1 -1 (+1 / -0 )Share on Facebook
  • saeyssaeys Member
    edited January 2018
    Yey! So these additions will be out in the next Gideros release? *fingers crossed* EDIT: Yes they will, 2018.1.1.
Sign In or Register to comment.