mirror of https://github.com/mgba-emu/mgba.git
Scripting: Add reference to the top-level engine in engine contexts
This commit is contained in:
parent
95336463bf
commit
73d19cc02a
|
@ -49,6 +49,8 @@ struct mScriptEngine2 {
|
||||||
|
|
||||||
struct mScriptEngineContext {
|
struct mScriptEngineContext {
|
||||||
struct mScriptContext* context;
|
struct mScriptContext* context;
|
||||||
|
struct mScriptEngine2* engine;
|
||||||
|
|
||||||
void (*destroy)(struct mScriptEngineContext*);
|
void (*destroy)(struct mScriptEngineContext*);
|
||||||
|
|
||||||
bool (*isScript)(struct mScriptEngineContext*, const char* name, struct VFile* vf);
|
bool (*isScript)(struct mScriptEngineContext*, const char* name, struct VFile* vf);
|
||||||
|
|
|
@ -288,10 +288,10 @@ static const luaL_Reg _mSTList[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mScriptContext* context) {
|
struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mScriptContext* context) {
|
||||||
UNUSED(engine);
|
|
||||||
struct mScriptEngineContextLua* luaContext = calloc(1, sizeof(*luaContext));
|
struct mScriptEngineContextLua* luaContext = calloc(1, sizeof(*luaContext));
|
||||||
luaContext->d = (struct mScriptEngineContext) {
|
luaContext->d = (struct mScriptEngineContext) {
|
||||||
.context = context,
|
.context = context,
|
||||||
|
.engine = engine,
|
||||||
.destroy = _luaDestroy,
|
.destroy = _luaDestroy,
|
||||||
.isScript = _luaIsScript,
|
.isScript = _luaIsScript,
|
||||||
.getGlobal = _luaGetGlobal,
|
.getGlobal = _luaGetGlobal,
|
||||||
|
|
Loading…
Reference in New Issue