Skip to content

Commit

Permalink
Lua: Correct chunkname (#138)
Browse files Browse the repository at this point in the history
* Correct chunkname

* Add source path for dostring
  • Loading branch information
actboy168 authored Oct 23, 2020
1 parent 8d7cc70 commit e3b74a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Lua/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void Interpreter::LoadFile(const String& file)
file_interface->Read(file_contents, size, handle);
file_interface->Close(handle);

if (luaL_loadbuffer(L, file_contents, size, file.c_str()) != 0)
if (luaL_loadbuffer(L, file_contents, size, ("@" + file).c_str()) != 0)
Report(L);
else //if there were no errors loading, then the compiled function is on the top of the stack
{
Expand Down
5 changes: 4 additions & 1 deletion Source/Lua/LuaDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ void LuaDocument::LoadScript(Stream* stream, const String& source_name)
else
{
String buffer;
buffer += "--";
buffer += this->GetSourceURL();
buffer += "\n";
stream->Read(buffer,stream->Length()); //just do the whole thing
Interpreter::DoString(buffer, this->GetSourceURL());
Interpreter::DoString(buffer, buffer);
}
}

Expand Down

0 comments on commit e3b74a4

Please sign in to comment.