globals
This commit is contained in:
6
src/vm.h
6
src/vm.h
@@ -91,6 +91,8 @@ typedef enum noomV_Opcode : unsigned char {
|
|||||||
NOOMV_INSTR_PUSHVAL,
|
NOOMV_INSTR_PUSHVAL,
|
||||||
// Pushes consts[op.uD]
|
// Pushes consts[op.uD]
|
||||||
NOOMV_INSTR_PUSHCONST,
|
NOOMV_INSTR_PUSHCONST,
|
||||||
|
// Pushes _G[consts[op.uD]], Lua 5.1 only.
|
||||||
|
NOOMV_INSTR_PUSHGLOBAL,
|
||||||
// Pushes op.sD itself as an integer
|
// Pushes op.sD itself as an integer
|
||||||
NOOMV_INSTR_PUSHINT,
|
NOOMV_INSTR_PUSHINT,
|
||||||
// Pushes op.uD nils
|
// Pushes op.uD nils
|
||||||
@@ -136,6 +138,8 @@ typedef enum noomV_Opcode : unsigned char {
|
|||||||
NOOMV_INSTR_SETVAL,
|
NOOMV_INSTR_SETVAL,
|
||||||
// pops value, sets *upvals[op.uD] = value
|
// pops value, sets *upvals[op.uD] = value
|
||||||
NOOMV_INSTR_SETUPVAL,
|
NOOMV_INSTR_SETUPVAL,
|
||||||
|
// pops value, sets _G[consts[op.uD]] = value
|
||||||
|
NOOMV_INSTR_SETGLOBAL,
|
||||||
|
|
||||||
// Control flow
|
// Control flow
|
||||||
|
|
||||||
@@ -205,6 +209,8 @@ typedef struct noomV_Function {
|
|||||||
noomV_Object obj;
|
noomV_Object obj;
|
||||||
// source location string
|
// source location string
|
||||||
noomV_String *chunkname;
|
noomV_String *chunkname;
|
||||||
|
// globals. Lua 5.1 only, use the _ENV upvalue for Lua 5.2+
|
||||||
|
noomV_Table *env;
|
||||||
noomV_Inst *code;
|
noomV_Inst *code;
|
||||||
noomV_Value *consts;
|
noomV_Value *consts;
|
||||||
struct noomV_Function **protos;
|
struct noomV_Function **protos;
|
||||||
|
|||||||
Reference in New Issue
Block a user