Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

menu -tutorial

edited October 2012 in General Posts: 19

Hallo, I tried the MENU - tutorial 1 - 3 without problem (see http://codeatuts.blogspot.com.au/p/contents.html)
next step is the Spashscreen ..
all works but Codea complains at this part:
[code]
function Fader:draw()
if self.fasding then
...
[/code]

self seem to be nil ??!!
If I add before the if:
self = fader

Fading works ????

Tagged:

Comments

  • Posts: 2,161

    Are you sure you're calling the draw function with a colon? If self is nil, that often indicates that the function was called via, for example, fader.draw() instead of fader:draw().

  • Posts: 19

    Yes am sure, just deleted and inserted it again:
    BUT idea: in the class SplashScreen a fader is built, so it has to be that one?!
    So inserting self = fader is correct??

  • edited October 2012 Posts: 2,161

    Putting in self = fader works because in that code fader is globally defined. However, that will make the class Fader useless as a class because only the globally defined one will be drawn. By doing that then you are mixing OO programming with non-OO methodology and this does not lead to good code.

    (Exercise in OO programming for you: make sure that the SplashScreen class is defined so that it is technically possible to have more than one instance of it.)

    Could you post some code? It's hard to debug without seeing exactly what you're doing. I still think it's a problem somewhere with a method being called incorrectly, but finding it without seeing the context will be difficult.

  • Posts: 19

    Thanks,
    Will first try to see this OO problem ;-).
    But I have this question: how can I export the total in one step to ???
    ??? e.g. my Dropbox
    How to do that from Codea isn't yet clear to me ... copy past one class after the other to the notebook (notities in NL) and then mailing is probably possible but eventually
    you, Andrew, know a real solution ;;) ?

  • Posts: 2,161

    From the list of your projects, touch and hold on the one you want until the menu comes up. Is there an option "Copy" or "Send by Email" in the list? (I'm a beta tester so not all the features I have in my version are the same as in the main one so I might have this wrong for you).

  • edited October 2012 Posts: 19

    Stupid Peter, sorry, indeed one can copy a total project (start pagina van Codea)

    Menu: up to tutorial 4 you can see it here:
    http://www.petergragert.info/pmwiki/pmwiki.php/Codea/TutorialMenu

  • Posts: 2,161

    Thought so!

    Line 44 of SplashScreen. You have fader.draw(). It should be fader:draw(). Note the colon instead of the full stop. If it's any consolation, it is probably the combination r: that makes it hard to see: the top of the r makes the higher dot of the : easy to miss.

    (I still say that having a global fader inside an instance of a class is Bad OO Programming.)

  • edited October 2012 Posts: 19

    Thanks, indeed You found my error, now it works as expected :)

    And learned how to chase the error.

  • Posts: 1

    Just to be clear, the copy project menu option only appears if you have a target that will accept the text to be pasted in, or zipped or whatever.

    I've just installed codea on a new machine and there was no copy menu option. Ok as long as I was bringing code across to it.

Sign In or Register to comment.