Jass+lua?

_whelp

New Member
Reaction score
54
Sorry for the spam but...

JASS:

//! externalblock extension=lua ObjectMerger $FILENAME$
//! i local message = "\"Why did he have to die?\""
//! i local msg = assert(io.open("jass\\\\hellotheremate.j", "w"))
//! i msg:write("function HTM takes nothing returns nothing\n")
//! i msg:write("local string msg = " .. message .. "\n")
//! i msg:write("call KillUnit(gg_unit_hpea_0001)\n")
//! i msg:write("call BJDebugMsg(msg)\n")
//! i msg:write("endfunction")
//! i msg:close()
//! endexternalblock
//! import "hellotheremate.j"

scope LuaTest initializer onInit
    private function onInit takes nothing returns nothing
        call HTM()
    endfunction
endscope


It really works! AHA!
 

Nestharus

o-o
Reaction score
84
Yup


So right now me and Azlier are pushing for import to run 2x, once before lua and once after this way it'll solve the double save issue and make everyone's life a little easier.

The next are lua tags similar to zinc tags-

JASS:

//! lua
//! endlua


this way you aren't writing //! i on every single line


For cJASS I'm pushing for them to fix the $ replacement with t's so that lua can be used.

The next thing I'm trying to get them to do is lua { } and #lua


From here, we need to be able to run lua directly into the lua interpreter if no exe is specified (to lower compile time).


Also perhaps we can get these into the jass pack distribution-
http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/
http://www.thomasandamy.com/projects/CPB/
 

Jesus4Lyf

Good Idea™
Reaction score
397
my maps are protected
Irrelevant.

Anyway, you guys just need import to run after external blocks, none of this "run twice" stuff, as far as I can see. You should better define your reqs.
JASS:
//! lua
//! endlua

That defeats the point of the //! tag in the first place - compiler instructions. It would also slaughter the ability to blend lua and JASS init funcs at the same time.
 

Nestharus

o-o
Reaction score
84
You'd still have //! i


Also the reason for double import is because jass files may have Lua in them =). Remember, not everyone writes all of the JASS in the maps.

The double import is very important. I've seen quite a few cases where groups are working on maps together and using an svn repository to store the code.
 

weaaddar

New Member
Reaction score
6
Hooray for a crazy idea that actually worked [on the second time]. Now, I wonder can you open inputwar3map.j (i.e. the file you are using) for more preprocessing abuse?

Just imagine implementing Template sby using lua and replacing stuff found in your map using <>, and then creating the right structs on demand. Would be nuts.
 

Nestharus

o-o
Reaction score
84
ofc you can.

Don't know why you'd want to do that though ><


I think all you need is a Lexical JASS Generator thing. From here you also need a global block.

These are quotes from my posts on JassHelper thread so everyone can catch up

Ok, so here are some necessities for Lua : )

the import command mentioned above by Azlier

#2- lua blocks like Zinc (//! lua, //! endlua)

atm writing pure lua is insane ; o.

Shouldn't be that difficult to do =).

#3- being able to run lua without having to run it through something would be nice =).

Ok, after some further working with Lua I think there needs to be a central exe for running the lua and passing lua into the various exes that the lua blocks might be using. This will allow for one global lua block so that the lua blocks can communicate with each other. It'll also let lua change from exe to exe (ObjectMerger to FileMerger etc) and it'll also allow for scripts that use no exe.


Each given block of lua would be properly scoped. For example, if you had local variables within a block, another lua block wouldn't be able to access them. This just means put each lua block passed into the central exe inside of do blocks, lol.


I think it should be included in the standard jass newgen pack. This core is just really important so that lua can communicate with lua in other sections of that map : o.

All of this JASS generation stuff would also be better in C (in the core) and called from Lua.

From here, you might also want to include-
http://www.tecgraf.puc-rio.br/~diego...nal/luasocket/

http://www.thomasandamy.com/projects/CPB/


LuaSocket would allow for online libraries and what not if someone wanted that. On the other hand, a script might be a trojan downloader ><. Really though, goods outweigh the possible bads ; ).

CPB would allow for easy C and C++ resources rather than the current style ><.

Who wants to write the C Core to process the Lua and delegate it to exes? : D

Or maybe JassHelper can do that itself

Who knows : o.


edit
Temporary Alternative To Lua Core

All Lua code must be within a macro and cannot run macros. It is up to the user to implement the code by running the macro.

No code may run itself. All code must be instanced by the user via Lua.

All code will initially be in a block determined by the map maker. Any code that requires the use of another block needs to generate the JASS file for that block as well as the code (single run).



For writing JASS, code will do its own lexical stuff by instantiating a new lexical thingie mabob, lol. At the end, the user generates the JASS code by just passing in lexical.code to JASS.generate. This will ensure all necessary code is generated and will make it so that there is only one //! import for all JASS code generated by Lua.

All Lua code should be completely split from JASS (obviously).


So the user determines the block that all of the Lua runs in and that's that. If the user wants other blocks, they follow the same paradigm if they want to generate JASS or use any of the Lua packages =).

This is only solution I can think of.
 

Nestharus

o-o
Reaction score
84
Writing out JASS via Lexical elements. Lexical just means block objects that you can write inside of. Example, lexical 1: struct, lexical 1-1: method, lexical 1-2: var, lexical 2: function, lexical1-1.write(var)
JASS:
struct
    method
        //written var from write
        var
    endmethod
    var
endstruct
function
endfunction
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
I'm sure I'm not the only one who has no idea what the heck that even means.
And isn't willing to read more than a 3 line explanation.

I'm not sure I'd even begin reading it. :nuts:
 
Reaction score
341
Unzip to your newgen directory.

JASS:
//!lua
do
lua
stuff
here
no //!
is
required
//!endlua


I wrote this in like 5 min so there are some annoyances.
  • war3map.j is double spaced?
  • Has to be //!lua with no spaces. (same for endlua)
 

Attachments

  • luastuff.zip
    545.6 KB · Views: 296

Nestharus

o-o
Reaction score
84
You running it through some sort of core lua thingie mabob though so you can change the blocks in real time and have all the scripts in the same scope? : o.

or might this just be a start :)

more specifically, what kind of code does it generate? does it just add //! i to each line?
 
Reaction score
341
nes said:
You running it through some sort of core lua thingie mabob though so you can change the blocks in real time and have all the scripts in the same scope? : o.

or might this just be a start

It's just a simple program which extracts the war3map.j, replaces everything inside lua tags with [ljass]//! i + text[/ljass] and re-imports it.
 

Nestharus

o-o
Reaction score
84
//! i + text you mean


Ok, you can improve it by putting them all through a common external block that can take exes (other external blocks) which it can then pass like normal.

Also through should be a space (like zinc..). Follow convention : D.

JASS:

//! lua
    //! block exe
        --lua code here!!
    //! endblock
    --lua code here!!
//! endlua


It'd pass in all of the lua script into that core lua processor thingie and that'd it turn run the lua and properly send arguments off to the other exes.

Furthermore, in lua, let people name the block almost like a file and let people use require. When they require something, it places one block of lua above or w/e.

For JASS generation, you can let me worry about that ; ). It'd be nice if you auto included like the core Lua thing I'm going to write for easy JASS generation at the top of the lua global script block ;o. Not super done yet though (needs some serious revisions).

Then all we need to do is fix the //! import and all should be good and also have it auto import the given file following convention.

So use the map name.lua, like
My Map.lua

So it should always import that file automatically. A var should be provided to retrieve the file name : ).

This should be most of the necessary stuff ; P.
 

Nestharus

o-o
Reaction score
84
You cant' directly compile that into anything.

You'd need to make an exe to handle it

That's the only way you'd be able to merge it all into one environment and be able to send off portions of that environment to other exes.


I frankly don't know enough about how all the tools in the background of jasshelper operate to do that ; |. I could make the exe, you could merge it into a global block, but I can't even figure out what parameters to take, otherwise I could probably manage it ><.
 
Reaction score
341
Have you used the tool?
Does it work properly?

I plan on just fixing the double spacing and allow for freedom with //! lua and thats it.
Unless ofc enough people want more stuff.

And no, I wouldn't use this tool most likely.

EDIT: Well, this worked.

JASS:
//! import &quot;test.j&quot;

scope wtf initializer onInit
    private function onInit takes nothing returns nothing
        //! externalblock extension=lua ObjectMerger $FILENAME$
        //!lua
            function CreateFile(name, contents)
                local file = assert(io.open(&quot;jass\\\\&quot;..name, &quot;w&quot;))
                file:write(contents)
                file:close()
            end
            CreateFile(&quot;test.j&quot;, &quot;function test takes nothing returns nothing\ncall BJDebugMsg(\&quot;Hello World!\&quot;)\nendfunction\n&quot;)
        //!endlua
        //! endexternalblock
        call test()
    endfunction
endscope
 

Nestharus

o-o
Reaction score
84
The tool doesn't do what I specifically need ; D.

I'll try it out though sec. Will edit post in one second after I tried it out : ).

edit
doesn't do anything to the text within the block ;o
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top