Relaxed the comparison from '<=>' to just '<', i.e instead of this
if xs[sortIdxA] < xs[sortIdxB] then
set cmp = -1
elseif xs[sortIdxB] < xs[sortIdxA]
set cmp = 1
set cmp = 0
it's now just:
set lt = xs[sortIdxA] < xs[sortIdxB]
Added a similar interface for binary...
It seems the game thinks that (tested on version 1.31):
returning nothing is false (probably because of the implicit return 0 in the bytecode)
returning integer 1 is true, 0 is false
returning real 1.0 is true, 0.0 is false
returning boolean true is true, false is false :^)
returning string ""...
The 'code' type is rather strange. One can assign to a variable of type 'code' a function that returns anything (any type) and nothing (void type). pjass doesn't seem to complain (ignoring the '+filter' flag and the ('Filter', 'Condition') natives) and the game is probably fine with this...
Although it's unlikely that you will get better error messages from JiffyJass' check mode than pjass, you could try, maybe?
There's a script attached to this post that you can use to convert your 'common.j' to something that can be used by JiffyJass for the...
It seems that after a load (at least on v1.31) 'string.unpack' becomes an alias for 'table.unpack', and 'string.pack' becomes an alias for 'table.pack'. If this is true then this seems like a typo kind of error to me.
local function callMeAfterLoad()
-- after a load 'string.unpack' becomes...
This is a follow up of Sorty loops which is "Not open for further replies".
I don't know why I didn't think of this earlier but it's very easy to go one step further and make the user do the swapping themselves. This way we avoid the copying from the user's arrays to ours. It also simplifies...
This is almost as bizarre as that bug that prevented save games from loading after writing to index 8191 of an array in older patches... save/loading is hard, I guess.
Here's a "goofy" way to stick to 'string.unpack' but not fail after a load:
local strUnpack = string.unpack
Looking in 'lua-src/lstrlib.c/str_pack,str_unpack', I am not seeing anything related to multi-byte encoding. Strings in Lua are "Lua is 8-bit clean: strings can contain any 8-bit value, including embedded zeros ('\0'). Lua is also encoding-agnostic; it makes no assumptions about the contents of...
If 'GetFourCC' uses 'string.pack', why not use 'string.unpack' for 'FourCC'? It's what blizzard's version does:
-- Helper function that enables the following syntax: ARCHMAGE = FourCC('Hamg')
return string.unpack(">I4", id)
Anyway... 'GetFourCC' seems like a bad...
Yeah, it works now with common.j-1.26.
Have you tried this (not very modern though)?
Hm... the order of evaluation is different. Well... actually it isn't =).
I'll be trying 'or' expressions next (to see if there are any bugs lurking there =)).
Edit: 'or' expressions seem fine (although they...
Tried with the 'jhcr-1.29.zip' and common.j (1.26, 1.29 and 1.31) but in-game (running 1.31) it I am getting an error (when the map gets selected). Previously I was using 'jhcr-126b-128.zip' (v. git-c50f36) with common.j-1.26 (again running 1.31).
I still think the bytecode generated by the...
It seems that 'jhcr' generates incorrect bytecode for 'and' expressions, it also generates pretty good bytecode for nested if statements, and that's a bit ironic =):
function B1 takes nothing returns boolean
function B2 takes nothing...
Yeah, it shouldn't be as dramatic because hashtable functions in wc3 are natives.
I was looking (despite not having a clue about Haskell) in 'Jass/Opt/Rewrite/SomeRules.hs' and the stuff there seemed like a very terse way of doing tree rewriting. But then I tried (jhcr compile...