1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Lua tags please : )

Discussion in 'Site Discussion' started by Nestharus, Aug 13, 2011.

  1. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    With more Lua code being written, I think it's time for Lua tags ; p
     
  2. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Thumbs up! Quite pointless reading in a JASS tag.
     
  3. Skycraft

    Skycraft

    Joined:
    Nov 11, 2010
    Messages:
    1,345
    Resources:
    0
    Resources:
    0
  4. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    So that LUA resources can have proper syntax highlighting.
     
  5. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    It's Lua, not LUA : p
     
  6. Crazed_seal2

    Crazed_seal2

    Joined:
    Jan 5, 2009
    Messages:
    824
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    While were at can we get some C++, Python and other tags on!
     
  7. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,842
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    Go and make a parser if you want highlighting, lazy bums.
     
  8. Ralle

    Ralle

    Owner

    Joined:
    Oct 6, 2004
    Messages:
    11,281
    Resources:
    22
    Tools:
    3
    Maps:
    5
    Tutorials:
    14
    Resources:
    22
    Does SC2 support Lua?
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Not sure about Sc2 but Jass NewGen Pack does support Lua.
     
  10. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Before we get Lua tags, can we at least get highlighting for the following natives:

    Code (vJASS):

    native GetPlayerUnitTypeCount takes player p, integer unitid returns integer
    native GetUnitGoldCost takes integer unitid returns integer
    native GetUnitWoodCost takes integer unitid returns integer
    native GetUnitBuildTime takes integer unitid returns integer

    native CreepsOnMap takes nothing returns boolean
    native UnitAlive takes unit id returns boolean
     


    ^^
     
  11. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Ask DSG the almighty.
     
  12. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    No, it does not.
     
  13. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,842
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    Make some JavaScript parsers, it's just too easy.
     
  14. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Stop it people!
    Give Ralle a break. We only want Lua tags >.<
     
  15. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,842
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    I was bored.

    highlight.js contains a pretty straightforward function that adds <span> tags to requested keywords, numbers and strings according to the given parameters.

    highlighText.js is a WebWorker that calls highlight() with the needed parameters for Jass files (I tried doing it on the main thread, but that makes browser get annoyed at the code).

    jass.js has all of the data from common.j and Blizzard.j in JavaScript arrays, it was generated with jass.rb (Ruby).

    test.js just creates the highlightText worker and allows the HTML file to send him your Jass code.

    Now you can add whatever languages you want by following the example of highlightText.js.

    Not too hard :/

    The styling is done using CSS, of course, so Google is your friend if you want another style.

    Oh and here's a test page.

    Edit: I originally forgot about comments, and since they make parsing harder, I instead went to the more sane solution and used CSS selectors, so CSS is now not inline anymore (CSS was meant to be external in the first place anyway).

    I most likely forgot some keywords and types, didn't touch Jass in years.
     

    Attached Files:

    Last edited: Aug 23, 2011
  16. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Idk, the problem with Lua is that it isn't as limited as JASS is. It is an actual stand-alone language. (so it might be a bit more annoying to code tags for)

    After-all, the only people who consistently use Lua on this site are me, you, and maybe 2-4 others. lol. :p
     
  17. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    I use Lua too, but I never needed to use it for public resources :p
    And I can't use it for spells because people hate that >.<
     
  18. Miss_Foxy

    Miss_Foxy

    Joined:
    Oct 15, 2008
    Messages:
    2,821
    Resources:
    0
    Resources:
    0
    Thumbs up!
    This would probably add more content to the current scripts and make it easier.
     
  19. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    This.
     
  20. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,502
    Resources:
    8
    Maps:
    8
    Resources:
    8
    I can try to make something with my newly acquired scripting knowledge if you point to me how Lua text should look like (I need to practice with something).