+ Reply to Thread
Results 1 to 9 of 9

Thread: object orientation in E2

  1. #1
    Wire Noob Hi117's Avatar
    Join Date
    Apr 2008
    Location
    in the us
    Posts
    17

    Lightbulb object orientation in E2

    i know this has been discussed before, but i think i found a 'hack' to get around high CPU requirements. if E2 used labels, it could simulate object orientation, especially if it returned to the previous spot in the code if E2 encountered a command; for example:
    Code:
    code
    goto label1
    more code
    
    :label 1
    code
    return or something like that
    in this case, the first lines of code before a label would be like the main function in c++ or java and every label would be like a function. the only problem i could see is looping via functions causing a lot of CPU and memory issues because a number variable would be needed to store where it last was. a way around the memory issue is to not have a return command but to have a goto at the end like:
    Code:
    :main
    code
    goto label1
    more code
    
    :label 1
    code
    goto main
    i'm not entirely sure how E2 works, but since its reading from a text file, it should be able to jump lines. it can be implemented by using the registerOperator() function like how inc is used.
    any thoughts?

  2. #2
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: object orientation in E2

    Well functions have been developed, which should be all you need.

  3. #3
    Wire Noob Hi117's Avatar
    Join Date
    Apr 2008
    Location
    in the us
    Posts
    17

    Default Re: object orientation in E2

    this is for jumping around within an expression, not calling functions

  4. #4
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: object orientation in E2

    Well I don't think that that would be easy due to the way E2 runs. And I still think that functions cover your needs for this. I mean, I wouldn't mind a jmp, but we already have call/returns (functions)

  5. #5
    Wire Sofaking Tasuit's Avatar
    Join Date
    Jan 2009
    Location
    Sønderjylland, Denmark
    Posts
    582
    Blog Entries
    9

    Default Re: object orientation in E2

    The E2 is a Micro Processor, not a programming language !

    Creator of the Unofficial servers

  6. #6
    ◕␣◕ McLovin's Avatar
    Join Date
    Sep 2008
    Location
    Batman, Turkey
    Posts
    2,346
    Blog Entries
    3

    Default Re: object orientation in E2

    Quote Originally Posted by Tasuit View Post
    The E2 is a Micro Processor, not a programming language !
    No, its a vm running a scripting language. Micro Processors cant fling objects magically. :P

    Jumping from label to label isn't object orientation, E2 is already somewhat object oriented. But using labels isn't really feasible due to the way it runs. And with functions its kind of pointless.
    Anticept - HP you are terrible at trolling. Always have been. Leave it up to the pros like Jat.
    Black Phoenix - Actually cunt goes into bullshit. Bullshit does not fit in cunt.
    Drunkie - Logically, Jat Goodwin must be a fist pumping guido.

  7. #7
    Wire Noob Hi117's Avatar
    Join Date
    Apr 2008
    Location
    in the us
    Posts
    17

    Default Re: object orientation in E2

    unless something changed without the wiki updating, you cant make a function using e2, you have to add it onto e2 with lua

  8. #8
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

  9. #9
    Wire Noob Hi117's Avatar
    Join Date
    Apr 2008
    Location
    in the us
    Posts
    17

    Default Re: object orientation in E2

    ahh so it is old news, just for the wrong reason XD this helps a ton thx

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots