MCPcopy Create free account
hub / github.com/TASEmulators/fceux / gui_register

Function gui_register

src/lua-engine.cpp:4824–4846  ·  view source on GitHub ↗

function gui.register(function f) This function will be called just before a graphical update. More complicated, but doesn't suffer any frame delays. Nil will be accepted in place of a function to erase a previously registered function, and the previous function (if any) is returned, or nil if none.

Source from the content-addressed store, hash-verified

4822// a previously registered function, and the previous function
4823// (if any) is returned, or nil if none.
4824static int gui_register(lua_State *L) {
4825
4826 // We'll do this straight up.
4827
4828
4829 // First set up the stack.
4830 lua_settop(L,1);
4831
4832 // Verify the validity of the entry
4833 if (!lua_isnil(L,1))
4834 luaL_checktype(L, 1, LUA_TFUNCTION);
4835
4836 // Get the old value
4837 lua_getfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
4838
4839 // Save the new value
4840 lua_pushvalue(L,1);
4841 lua_setfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
4842
4843 // The old value is on top of the stack. Return it.
4844 return 1;
4845
4846}
4847
4848// table sound.get()
4849static int sound_get(lua_State *L)

Callers

nothing calls this directly

Calls 5

lua_settopFunction · 0.85
luaL_checktypeFunction · 0.85
lua_getfieldFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected