MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / str_char

Function str_char

3rd/lua-5.4.3/src/lstrlib.c:195–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194
195static int str_char (lua_State *L) {
196 int n = lua_gettop(L); /* number of arguments */
197 int i;
198 luaL_Buffer b;
199 char *p = luaL_buffinitsize(L, &b, n);
200 for (i=1; i<=n; i++) {
201 lua_Unsigned c = (lua_Unsigned)luaL_checkinteger(L, i);
202 luaL_argcheck(L, c <= (lua_Unsigned)UCHAR_MAX, i, "value out of range");
203 p[i - 1] = uchar(c);
204 }
205 luaL_pushresultsize(&b, n);
206 return 1;
207}
208
209
210/*

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