- Joined
- Jul 10, 2007
- Messages
- 6,306
Working on a new tool for WE called JASS Infinity.
All precompiler statements are sent to Lua and are then translated into JASS code =).
Thus far, I've figured out how to read/write to wc3 map, extend Lua with c++, do Lua plugins with c++ in separate dlls, and parse out a language =).
Here is a preview for the language =P
All precompiler statements are sent to Lua and are then translated into JASS code =).
Thus far, I've figured out how to read/write to wc3 map, extend Lua with c++, do Lua plugins with c++ in separate dlls, and parse out a language =).
Here is a preview for the language =P
$label = Lua var
#awesome = Unit.create('hpea')
#awesome.name = "awesome"
#awesome.goldCost = 60
local integer goldCost = $awesome.goldCost //awesome?
local integer getOutput = $crazyLuaFunction() //double awesome?
//T is a local constant in this case, accessible by both Lua and vjass as a map constant
list<T>
#if ($T == $INT) then
#else if
#end
static if T == INT
elseif
endif
Lua can access all vjass map constants via $
All vjass primitive constants are translated into map constants and they maintain scope!
debug keyword ->
#if ($DEBUG_MODE) then
writeline(jass)
#end
enum
#function print(a)
DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,$a)
#end
//watch me spam some code, make a print function in Lua ;D
#print("yo")
#print("omg")
struct extends array auto removes code
rewriting allocate or deallocate auto removes code
extends, :
multiple extension, no more super, use ClassType
Union: group of variables
foreach, uses first, last, end, next, prev
foreach (var in list) { }
foreach (var in list from list.first to list.last) { }
foreach (var in list from list.last to list.first) { }
for (auto i = 3; i != 6; ++i) { }
i++, ++i, etc
Smart polymorphism, only evaluate when run by a superclass
protected
public
private
readonly
modules with implement a(args)
auto null all handle locals that need nulling and auto safe return
smarter auto inlining (inline if it's a var or ref'd one time)
auto run blocks, no more stupid onInit
{ }
lambda expressions
ForGroup(hi, { code } -> bool )
static ifs -> Lua ifs (#elseif turns into #else if and #endif turns into #end)
all constants used in static ifs have $ put in front of them
ternary operator
bool? this : otherwise
fix '\\\\\\\\'
string = SubString(string, i, i + 1)
string[i .. i2] = substring(string, i, i + i2)
string.length
writing methods outside of structs that take custom pointers
void this.method(unit this) { }
real this.hp(widget this) { return GetWidgetLife(this) }
print(peasant.hp)
Lua
replace all \$ with $ inside of strings
replace all $ with str .. var .. str inside of strings
auto i = 3
integer i = 3
locals declared anywhere in function with scope
{ } in function is internal scope
void hi() {
{ int a; set a = 3 }
{ int b; set b = 6 }
}
function hi takes nothing returns nothing
local integer a
set a = 3
set a = 6
endfunction
scope A
public func
A::func
A() constructor
~A() destructor
new A()
delete A
void hi()
void hi(string s)
void hi(int i)
void hi(string s, int i)
modulo: 3%5
i = 3%5
i = 3 - 3/5*5
Last edited: