MCPcopy Create free account
hub / github.com/Tencent/UnLua / ReadLine

Method ReadLine

Plugins/UnLua/Source/UnLua/Private/BaseLib/LuaLib_File.cpp:162–187  ·  view source on GitHub ↗

ReadLine

Source from the content-addressed store, hash-verified

160
161 //ReadLine
162 FORCEINLINE void ReadLine(lua_State *L, bool bWithNewLineCh = false)
163 {
164 if (FILE->AtEnd())
165 {
166 lua_pushnil(L);
167 }
168 else
169 {
170 TArray<uint8> Buffer;
171 uint8 Ch;
172 while (!FILE->AtEnd())
173 {
174 FILE->SerializeBits(&Ch, sizeof(uint8) * 8);
175 if (Ch == '\n')
176 {
177 if (bWithNewLineCh)
178 {
179 Buffer.Add(Ch);
180 }
181 break;
182 }
183 Buffer.Add(Ch);
184 }
185 lua_pushlstring(L, (const char*)Buffer.GetData(), Buffer.Num());
186 }
187 }
188
189
190 FORCEINLINE void ReadNumber(lua_State *L)

Callers 1

UE4File_ReadFileFunction · 0.80

Calls 5

lua_pushnilFunction · 0.85
lua_pushlstringFunction · 0.85
AddMethod · 0.45
GetDataMethod · 0.45
NumMethod · 0.45

Tested by

no test coverage detected