Starting JASS

tooltiperror

Super Moderator
Reaction score
231
^adding on what king said.

JASS:

struct Data
 method empathy takes nothing returns nothing
 endmethod
endstruct


That will compile in normal JASS to something like this:

JASS:

globals
integer nl_data_emapthy_alloc_
endglobals
function NL_DATA__empathy_ takes integer this returns nothing
endfunction


You know, a lot of random global blocks and random stuff. But it should show you that methods end up taking an integer called 'this'. If no one explained this yet, structs are integers.

JASS:

struct Data
integer lmao
endstruct
function onInit takes nothing returns nothing
    local Data data=Data.create()
    set data.lmao=3
endfunction


becomes->

JASS:

function onInit takes nothing returns nothing
    local integer data=nl_data__allocate()
    set lmao[data]=3
endfunction


See? this is just an integer pointing to a link in an array.
 

Ayanami

칼리
Reaction score
288
Thanks for the explanation. So is there any way to call a method in the Filter(function)?
 

decored

New Member
Reaction score
3
I suggest doing others as knockback requires timers struct etc for full effective. But if you can code in GUI i dont think you will ave a problem
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Thanks for the explanation. So is there any way to call a method in the Filter(function)?
Use a global to pass data.
You don't have to care about the MUIability, because it is instant.
 

roXplosive

New Member
Reaction score
15
I've just read this passage and i'm facepalming right now . I really don't get why Blizzard did structures this way since i know from programming (let's stick to C++) that an object is a data structure containing in order for each instance the member data as the type it is defined as and might get aditional fields that are pointers to polymorphic functions that are specific to the object if it is derived from a base class .

As for method calling the parameters passed to stack before calling are : pointer to the object calling the method named with "this" and the other function parameters .

So i'm asking the following questions about structures and similarities with C++ :

1) which is the default sharing of member data (default C++ is private)
2) is there a sharing parameter besides private and public like the "protected" of C++
3) can you declare abstract structures ? In C++ abstract structures can not have instances and their member functions are specified without parameters and ended with =0
4) the declarations of new structures is alike to the "Public" inhgeritance ? In c++ there are 3 types of inheritance : public : the new class has access to all the members of the base class can use all the data of the base class , protected : can use public and protected members of the base class and the members defined as protected in the base class become private here private inheritance turns all the data of the base struct into private regarding the new class , so deriving this class more would render the new objects unable to use the grandparent's class members
5) the C++ had a nice feature making possible to create eterogenous arrays using the inheritance of classes knowing that a pointer to a base class can point to a data of a derived type from the base
6) are restrictions to redefining methods of the base class in the classes inheriting it ?
 

Sevion

The DIY Ninja
Reaction score
413
Why are you posting this here?

And Blizzard did not make vJASS. Vexorian did.

1. Public with no prefix.
2. No.
3. No.
4. You prefix each member and method with the access level.
5. I'm sorry, but I don't understand. "eterogenous" is not an English word. If you mean two arrays that have the same values as a base array, then you have to manually clone the arrays.
6. If you want to redefine methods in child structs, you have to make the parent have stub methods.
 

Bribe

vJass errors are legion
Reaction score
67
Actually, Sevion, a "stub" method is mildly similar to a "protected" method, so #2 should not entirely be false.

I don't know how many of these features are unlockable in StarCraft 2, but there may be some room for this guy with the (Andromeda?) language.

vJass is semi-automatic with a lot of its functions. Things that are automatic with PHP, C++ can be done with certain libraries people have made. It may interest you that there is very little need for hashtables in most cases; people have found really useful methods of indexing data without the limitation of the pathetic 8192-sized array.
 

Sevion

The DIY Ninja
Reaction score
413
True, at that. My mistake.

Actually, all of these answers can be found in the JassHelper manual.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top