PDA

View Full Version : Lua tags please : )


Nestharus
08-13-2011, 10:29 PM
With more Lua code being written, I think it's time for Lua tags ; p

baassee
08-18-2011, 01:38 PM
Thumbs up! Quite pointless reading in a JASS tag.

Skycraft
08-18-2011, 01:51 PM
Why? :P

Bribe
08-18-2011, 03:20 PM
So that LUA resources can have proper syntax highlighting.

Nestharus
08-21-2011, 02:19 AM
LUA


It's Lua, not LUA : p

Crazed_seal2
08-21-2011, 02:30 AM
While were at can we get some C++, Python and other tags on!

GhostWolf
08-21-2011, 04:59 PM
Go and make a parser if you want highlighting, lazy bums.

Ralle
08-22-2011, 10:12 AM
Does SC2 support Lua?

Bribe
08-22-2011, 10:34 AM
Not sure about Sc2 but Jass NewGen Pack does support Lua.

Magtheridon96
08-22-2011, 01:28 PM
Before we get Lua tags, can we at least get highlighting for the following natives:


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


^^

baassee
08-22-2011, 05:24 PM
Does SC2 support Lua?

Ask DSG the almighty.

busterkomo
08-22-2011, 05:31 PM
Does SC2 support Lua?
No, it does not.

GhostWolf
08-22-2011, 05:53 PM
Make some JavaScript parsers, it's just too easy.

Magtheridon96
08-22-2011, 11:22 PM
Stop it people!
Give Ralle a break. We only want Lua tags >.<

GhostWolf
08-23-2011, 07:14 AM
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 (http://dl.dropbox.com/u/26776837/syntax%20highlighter/test.html).

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.

PurgeandFire
08-30-2011, 05:09 AM
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

Magtheridon96
08-30-2011, 05:33 AM
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 >.<

Miss_Foxy
08-30-2011, 06:54 AM
Thumbs up!
This would probably add more content to the current scripts and make it easier.

baassee
08-30-2011, 04:36 PM
And I can't use it for spells because people hate that >.<

This.

Rui
08-30-2011, 05:19 PM
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).

Statharas
08-30-2011, 05:28 PM
Ralle, stop working on H2.0 and make the trigger tags recognize Sc2 Triggers. And make a Galaxy parser.

What's the use of a Lua parser anyway?

Nestharus
08-30-2011, 06:40 PM
Ralle, here are some Lua editors

http://www.wowwiki.com/Lua_editors

And Lua ref manual

http://www.lua.org/manual/5.1/

-Kobas-
08-31-2011, 09:20 AM
Why not to use it within spells?

Just paste code within map somewhere or import it into import manager within txt file so user can easily import spell without CNP object editor data, he can run script and remove it after that.

It should be faster and easier, right? Or maybe I miss something?

Nestharus
08-31-2011, 03:30 PM
It should be faster and easier, right? Or maybe I miss something?


It is, but a lot of users are afraid of Lua, even with a super simple how to use Lua tut.

-Kobas-
08-31-2011, 05:30 PM
Is there anything that can ruin map, example, what will happen if we try to generate object 'A000' but there is already one?

Sorry I didn't tested those things.

Nestharus
08-31-2011, 05:37 PM
It'll overwrite 'A000'

That's why you use LUA_GET_VAR_OBJECT


See purge's tutorial on writing Lua for wc3 ; P. There is a whole framework I developed =). Normally in wc3 Lua, you can't even use dofile, but the framework lets you do it : p.

-Kobas-
08-31-2011, 06:02 PM
I saw that a while ago (Still waiting that demo map :razz:).
Ok then, I don't need to know anything else.

If user know to use Lua, then why not to have, for example, script in resource for really easy importing.
You have my vote :)

Nestharus
08-31-2011, 11:09 PM
and with my tutorial on how to get Lua scripts into your map, it should be really easy for users who want to use scripts using Lua that don't want to learn Lua.

Miss_Foxy
09-02-2011, 09:35 AM
Ralle, stop working on H2.0 and make the trigger tags recognize Sc2 Triggers. And make a Galaxy parser.

What's the use of a Lua parser anyway?

This, please Ralle(:

Oh and the Lua tags would be useful as well, some of my friends are more comfortable with it, hehe...

Ralle
09-04-2011, 12:28 PM
I will see what I can do :)

Nestharus
10-22-2011, 03:38 AM
So any word on these natives?


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


And Lua tags?


local message = "hello" .. " " .. "world"

Bribe
10-22-2011, 08:29 AM
I don't know if it's such a good idea to highlight the AI natives because those require some extra attention, like the need to declare them in the first place, and the fact the optimizer breaks them.

Magtheridon96
10-23-2011, 12:59 AM
and the fact the optimizer breaks them.

The optimizer is like AutoIndex. Old school.
The Froptimizer seems promising :3

Nestharus
10-23-2011, 04:05 AM
I don't know if it's such a good idea to highlight the AI natives because those require some extra attention, like the need to declare them in the first place, and the fact the optimizer breaks them.


Natives are natives.

Bribe
10-23-2011, 09:01 AM
The froptimizer doesn't exist yet. I suppose we could add highlighting for these natives if only there was some way we could seperate them from that natives that don't need to be declared.

marko9
10-23-2011, 10:16 AM
WFT is Lua ? lol

Magtheridon96
10-23-2011, 11:03 AM
http://www.lmgtfy.com/?q=Lua