@@ -187,18 +187,21 @@ namespace casioemu {
187
187
return 0 ;
188
188
});
189
189
lua_setfield (lua_state, -2 , " tick" );
190
+
190
191
lua_pushcfunction (lua_state, [](lua_State *lua_state) {
191
192
Emulator *emu = *(Emulator **)lua_topointer (lua_state, 1 );
192
193
emu->Shutdown ();
193
194
return 0 ;
194
195
});
195
196
lua_setfield (lua_state, -2 , " shutdown" );
197
+
196
198
lua_pushcfunction (lua_state, [](lua_State *lua_state) {
197
199
Emulator *emu = *(Emulator **)lua_topointer (lua_state, 1 );
198
200
emu->SetPaused (lua_toboolean (lua_state, 2 ));
199
201
return 0 ;
200
202
});
201
203
lua_setfield (lua_state, -2 , " set_paused" );
204
+
202
205
lua_model_ref = LUA_REFNIL;
203
206
lua_pushcfunction (lua_state, [](lua_State *lua_state) {
204
207
Emulator *emu = *(Emulator **)lua_topointer (lua_state, 1 );
@@ -207,7 +210,6 @@ namespace casioemu {
207
210
// emu:model() returns the model table
208
211
lua_geti (lua_state, LUA_REGISTRYINDEX, emu->lua_model_ref );
209
212
return 1 ;
210
-
211
213
case 2 :
212
214
// emu:model(t) sets the model table
213
215
if (emu->lua_model_ref != LUA_REFNIL)
@@ -220,6 +222,7 @@ namespace casioemu {
220
222
}
221
223
});
222
224
lua_setfield (lua_state, -2 , " model" );
225
+
223
226
lua_pre_tick_ref = LUA_REFNIL;
224
227
lua_pushcfunction (lua_state, [](lua_State *lua_state) {
225
228
Emulator *emu = *(Emulator **)lua_topointer (lua_state, 1 );
@@ -228,6 +231,7 @@ namespace casioemu {
228
231
return 0 ;
229
232
});
230
233
lua_setfield (lua_state, -2 , " pre_tick" );
234
+
231
235
lua_post_tick_ref = LUA_REFNIL;
232
236
lua_pushcfunction (lua_state, [](lua_State *lua_state) {
233
237
Emulator *emu = *(Emulator **)lua_topointer (lua_state, 1 );
@@ -236,6 +240,7 @@ namespace casioemu {
236
240
return 0 ;
237
241
});
238
242
lua_setfield (lua_state, -2 , " post_tick" );
243
+
239
244
lua_setfield (lua_state, -2 , " __index" );
240
245
lua_pushcfunction (lua_state, [](lua_State *) {
241
246
return 0 ;
@@ -353,7 +358,6 @@ namespace casioemu {
353
358
354
359
void Emulator::Shutdown () {
355
360
std::lock_guard<decltype (access_mx)> access_lock (access_mx);
356
-
357
361
running = false ;
358
362
}
359
363
0 commit comments