summaryrefslogtreecommitdiff
path: root/src/script/common/c_packer.h
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-05-10 16:37:33 -0400
committerGitHub <noreply@github.com>2022-05-10 22:37:33 +0200
commit7f58887ae33893c981fbdff23d4e1fa4a11c32e4 (patch)
tree5705ee5c5f6c2f1b3c1380d0fba2d01205c5455d /src/script/common/c_packer.h
parentd17d7eba14f6a1328a3b58ee086df5ffa56304d6 (diff)
downloadminetest-7f58887ae33893c981fbdff23d4e1fa4a11c32e4.tar.gz
minetest-7f58887ae33893c981fbdff23d4e1fa4a11c32e4.tar.bz2
minetest-7f58887ae33893c981fbdff23d4e1fa4a11c32e4.zip
Support packing arbitrary graphs (#12289)
Diffstat (limited to 'src/script/common/c_packer.h')
-rw-r--r--src/script/common/c_packer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/common/c_packer.h b/src/script/common/c_packer.h
index 8bccca98d..ee732be86 100644
--- a/src/script/common/c_packer.h
+++ b/src/script/common/c_packer.h
@@ -36,6 +36,7 @@ extern "C" {
#define INSTR_SETTABLE (-10)
#define INSTR_POP (-11)
+#define INSTR_PUSHREF (-12)
/**
* Represents a single instruction that pushes a new value or works with existing ones.
@@ -44,6 +45,7 @@ struct PackedInstr
{
s16 type; // LUA_T* or INSTR_*
u16 set_into; // set into table on stack
+ bool keep_ref; // is referenced later by INSTR_PUSHREF?
bool pop; // remove from stack?
union {
bool bdata; // boolean: value
@@ -60,6 +62,7 @@ struct PackedInstr
s32 sidata1, sidata2;
};
void *ptrdata; // userdata: implementation defined
+ s32 ref; // PUSHREF: index of referenced instr
};
/*
- string: value
@@ -69,7 +72,7 @@ struct PackedInstr
*/
std::string sdata;
- PackedInstr() : type(0), set_into(0), pop(false) {}
+ PackedInstr() : type(0), set_into(0), keep_ref(false), pop(false) {}
};
/**