1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Support packing arbitrary graphs (#12289)

This commit is contained in:
Jude Melton-Houghton 2022-05-10 16:37:33 -04:00 committed by GitHub
parent d17d7eba14
commit 7f58887ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 54 deletions

View file

@ -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) {}
};
/**