Original:
0001 TGETS 1 0 0 ; "_hud_debuff_blackboard"
0002 TGETS 2 1 1 ; "wounded"
0003 GGET 3 3 ; "GameSession"
0004 TGETS 3 3 4 ; "game_object_field"
My code
0001 TGETS 1 0 0 ; "_hud_debuff_blackboard"
0002 TGETS 2 1 1 ; "wounded"
0003 GGET 3 2 ; "GameSession"
0004 TGETS 3 3 3 ; "game_object_field"
As far as I can tell the values in blue refer to the table index, mine seems to be 1 less which would suggest something gets added to the table inbetween 'TGETS' and 'GGET 'that doesn't get compiled (at least not as its own opcode). my initial thought is something to do with a local (as they dont get compiled as an opcode) but creating a new one and initializing it always adds an extra move/call.
Edit:
So after some investigation and a chat with the luajit guy I worked it out. Heres the code in case anyone is interested:
bytecode
Code: Select all
0001 TGETS 1 0 0 ; "_hud_debuff_blackboard"
0002 TGETS 2 1 1 ; "wounded"
0003 GGET 3 3 ; "GameSession"
0004 TGETS 3 3 4 ; "game_object_field"
0005 TGETS 4 0 5 ; "_game"
0006 TGETS 5 0 6 ; "_game_object_id"
0007 KSTR 6 1 ; "wounded"
0008 CALL 3 2 4
0009 ISF 3
0010 JMP 4 => 0013
0011 KSHORT 3 1
0012 JMP 4 => 0014
0013 => KSHORT 3 0
0014 => TSETS 3 2 2 ; "level"
Code: Select all
function PlayerUnitDamage._set_debuff_blackboard_fields(arg1)
local a = arg1._hud_debuff_blackboard
local b = a.wounded
b.level = GameSession.game_object_field(arg1._game,arg1._game_object_id,"wounded") and 1 or 0
....more code
End