@@ -62,8 +62,7 @@ namespace Lua {
62
62
LuaUtils::RunFunction (LUA, 4 , 0 );
63
63
64
64
MemAlloc_Free (data);
65
- }
66
- else {
65
+ } else {
67
66
LUA->PushNumber (FSASYNC_ERR_NOT_MINE);
68
67
LuaUtils::RunFunction (LUA, 3 , 0 );
69
68
}
@@ -147,14 +146,14 @@ namespace Lua {
147
146
148
147
LUA_FUNCTION (AsyncRead) {
149
148
std::string fileName = LUA->CheckString (1 );
150
- std::string gamePath = LUA->CheckString (2 );
149
+ const char * gamePath = LUA->CheckString (2 );
151
150
152
151
if (!PathUtils::FixPath (fileName)) {
153
152
LUA->PushNumber (FSASYNC_ERR_FILEOPEN);
154
153
return 1 ;
155
154
}
156
155
157
- auto task = std::make_shared<AsyncReadTask>(fileName, gamePath);
156
+ auto task = std::make_shared<AsyncReadTask>(fileName, LuaUtils::GetGamePath (LUA, gamePath) );
158
157
if (LUA->IsType (3 , GarrysMod::Lua::Type::Function)) {
159
158
LUA->Push (3 );
160
159
task->callbackRef = LUA->ReferenceCreate ();
@@ -193,14 +192,14 @@ GMOD_MODULE_OPEN() {
193
192
LUA->Pop ();
194
193
LUA->CreateTable ();
195
194
}
196
- LUA->PushCFunction (Lua::AsyncAppend);
197
- LUA->SetField (-2 , " AsyncAppend" );
195
+ LUA->PushCFunction (Lua::AsyncAppend);
196
+ LUA->SetField (-2 , " AsyncAppend" );
198
197
199
- LUA->PushCFunction (Lua::AsyncWrite);
200
- LUA->SetField (-2 , " AsyncWrite" );
198
+ LUA->PushCFunction (Lua::AsyncWrite);
199
+ LUA->SetField (-2 , " AsyncWrite" );
201
200
202
- LUA->PushCFunction (Lua::AsyncRead);
203
- LUA->SetField (-2 , " AsyncRead" );
201
+ LUA->PushCFunction (Lua::AsyncRead);
202
+ LUA->SetField (-2 , " AsyncRead" );
204
203
LUA->SetField (GarrysMod::Lua::INDEX_GLOBAL, " asyncio" );
205
204
206
205
return 0 ;
0 commit comments