MCPcopy Create free account
hub / github.com/DFHack/dfhack / str_char

Function str_char

depends/lua/src/lstrlib.c:167–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167static int str_char (lua_State *L) {
168 int n = lua_gettop(L); /* number of arguments */
169 int i;
170 luaL_Buffer b;
171 char *p = luaL_buffinitsize(L, &b, n);
172 for (i=1; i<=n; i++) {
173 lua_Integer c = luaL_checkinteger(L, i);
174 luaL_argcheck(L, uchar(c) == c, i, "value out of range");
175 p[i - 1] = uchar(c);
176 }
177 luaL_pushresultsize(&b, n);
178 return 1;
179}
180
181
182static int writer (lua_State *L, const void *b, size_t size, void *B) {

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
luaL_buffinitsizeFunction · 0.85
luaL_checkintegerFunction · 0.85
luaL_pushresultsizeFunction · 0.85

Tested by

no test coverage detected