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

Function tobitstring

src/lua-engine.cpp:1840–1847  ·  view source on GitHub ↗

tobitstring(int value) Converts byte to binary string

Source from the content-addressed store, hash-verified

1838//
1839// Converts byte to binary string
1840static int tobitstring(lua_State *L)
1841{
1842 std::bitset<8> bits (luaL_checkinteger(L, 1));
1843 std::string temp = bits.to_string().insert(4, " ");
1844 const char * result = temp.c_str();
1845 lua_pushstring(L,result);
1846 return 1;
1847}
1848
1849// like rawToCString, but will check if the global Lua function tostring()
1850// has been replaced with a custom function, and call that instead if so

Callers

nothing calls this directly

Calls 2

luaL_checkintegerFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected