Skip to content

Commit

Permalink
Minor verbiage tweaks in several places
Browse files Browse the repository at this point in the history
  • Loading branch information
mkruselj committed Dec 12, 2024
1 parent 3a4ff98 commit d5f4d5c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
25 changes: 13 additions & 12 deletions src/common/LuaSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ int Surge::LuaSupport::parseStringDefiningMultipleFunctions(
switch (lerr)
{
case LUA_ERRSYNTAX:
oss << "Lua Syntax Error: ";
oss << "Lua syntax error: ";
break;
case LUA_ERRMEM:
oss << "Lua Memory Allocation Error: ";
oss << "Lua memory allocation error: ";
break;
default:
// The default case should never get called unless the underlying Lua library source
// gets modified, but we can handle it anyway
oss << "Lua Unknown Error: ";
oss << "Lua unknown error: ";
break;
}
oss << lua_tostring(L, -1);
Expand All @@ -81,17 +81,17 @@ int Surge::LuaSupport::parseStringDefiningMultipleFunctions(
switch (lerr)
{
case LUA_ERRRUN:
oss << "Lua Evaluation Error: ";
oss << "Lua evaluation error: ";
break;
case LUA_ERRMEM:
oss << "Lua Memory Allocation Error: ";
oss << "Lua memory allocation error: ";
break;
case LUA_ERRERR:
// We're running pcall without an error function now but we might in the future
oss << "Lua Error Handler Function Error: ";
oss << "Lua error handler function error: ";
break;
default:
oss << "Lua Unknown Error: ";
oss << "Lua unknown error: ";
break;
}
oss << lua_tostring(L, -1);
Expand Down Expand Up @@ -146,7 +146,7 @@ static int lua_sandboxPrint(lua_State *L)
for (int i = 1; i <= n; i++)
{
if (!lua_isstring(L, i))
return luaL_error(L, "Error: 'print' only accepts strings or numbers");
return luaL_error(L, "Error: print() only accepts strings or numbers!");
const char *s = lua_tostring(L, i); // get the string
fputs(s, stdout); // print the string
}
Expand Down Expand Up @@ -196,7 +196,7 @@ bool Surge::LuaSupport::setSurgeFunctionEnvironment(lua_State *L)
if (lua_isnil(L, -1)) // check if the global exists
{
lua_pop(L, 1);
std::cout << "Error: global not found [ " << f << " ]" << std::endl;
std::cout << "Error: Global not found! [ " << f << " ]" << std::endl;
continue;
}
lua_setfield(L, -2, f); // stack: f>t
Expand All @@ -213,7 +213,7 @@ bool Surge::LuaSupport::setSurgeFunctionEnvironment(lua_State *L)
if (!lua_istable(L, gidx))
{
lua_pop(L, 1);
std::cout << "Error: not a table [ " << t << " ]" << std::endl;
std::cout << "Error: Not a table! [ " << t << " ]" << std::endl;
continue;
}

Expand Down Expand Up @@ -288,13 +288,14 @@ bool Surge::LuaSupport::loadSurgePrelude(lua_State *L, const std::string &lua_sc
auto status = luaL_loadbuffer(L, lua_script.c_str(), lua_size, lua_script.c_str());
if (status != 0)
{
std::cout << "Error: Failed to load Lua file [ " << lua_script.c_str() << " ]" << std::endl;
std::cout << "Error: Failed to load Lua file! [ " << lua_script.c_str() << " ]"
<< std::endl;
return false;
}
auto pcall = lua_pcall(L, 0, 1, 0);
if (pcall != 0)
{
std::cout << "Error: Failed to run Lua file [ " << lua_script.c_str() << " ]" << std::endl;
std::cout << "Error: Failed to run Lua file! [ " << lua_script.c_str() << " ]" << std::endl;
return false;
}
lua_setglobal(L, surgeTableName);
Expand Down
32 changes: 16 additions & 16 deletions src/common/dsp/modulators/FormulaModulationHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ end
{
if (fs->formulaString != lua_tostring(s.L, -1))
{
s.adderror("Hash Collision in function. Bad luck!");
s.adderror("Hash collision in function! Bad luck...");
}
else
{
Expand Down Expand Up @@ -177,7 +177,7 @@ end
}
else
{
s.adderror("Unable to determine 'process' or 'init' function : " + emsg);
s.adderror("Unable to determine process() or init() function : " + emsg);
lua_pop(s.L, 1); // process
lua_pop(s.L, 1); // process
stateData.knownBadFunctions.insert(s.funcName);
Expand Down Expand Up @@ -250,7 +250,7 @@ end
if (!lua_istable(s.L, -1))
{
s.isvalid = false;
s.adderror("The init() function must return a table. This usually means "
s.adderror("The init() function must return a table.\nThis usually means "
"that you didn't close the init() function with 'return state' "
"before the 'end' statement.");
stateData.knownBadFunctions.insert(s.funcName);
Expand All @@ -260,7 +260,7 @@ end
{
s.isvalid = false;
std::ostringstream oss;
oss << "Failed to evaluate 'init' function. " << lua_tostring(s.L, -1);
oss << "Failed to evaluate init() function! " << lua_tostring(s.L, -1);
s.adderror(oss.str());
stateData.knownBadFunctions.insert(s.funcName);
}
Expand All @@ -281,7 +281,7 @@ end
if (!lua_istable(s.L, -1))
{
lua_pop(s.L, -1);
std::cout << "Not a table" << std::endl;
std::cout << "Not a table!" << std::endl;
}
else
{
Expand Down Expand Up @@ -385,7 +385,7 @@ end
s.is_display = true;

if (s.raisedError)
std::cout << "ERROR: " << *(s.error) << std::endl;
std::cout << "Error: " << *(s.error) << std::endl;
#endif

return true;
Expand Down Expand Up @@ -620,9 +620,9 @@ void valueAt(int phaseIntPart, float phaseFracPart, SurgeStorage *storage,
}
if (!lua_istable(s->L, -1))
{
s->adderror(
"The return of your LUA function must be a number or table. Just return input with "
"output set.");
s->adderror("The return of your Lua function must be a number or table!\nJust return "
"input with "
"output set.");
s->isvalid = false;
lua_pop(s->L, 1);
return;
Expand Down Expand Up @@ -654,13 +654,13 @@ void valueAt(int phaseIntPart, float phaseFracPart, SurgeStorage *storage,
if (idx <= 0 || idx > max_formula_outputs)
{
std::ostringstream oss;
oss << "Error with vector output. The vector output must be"
oss << "Error with vector output!\nThe vector output must be"
<< " an array with size up to 8. Your table contained"
<< " index " << idx;
if (idx == -1)
oss << " which is not an integer array index.";
oss << ", which is not an integer array index.";
if (idx > max_formula_outputs)
oss << " which means your result is too long.";
oss << ", which means your array is too large.";
s->adderror(oss.str());
auto &stateData = *storage->formulaGlobalData;
stateData.knownBadFunctions.insert(s->funcName);
Expand All @@ -683,8 +683,8 @@ void valueAt(int phaseIntPart, float phaseFracPart, SurgeStorage *storage,

if (stateData.knownBadFunctions.find(s->funcName) != stateData.knownBadFunctions.end())
s->adderror(
"You must define the 'output' field in the returned table as a number or "
"float array");
"You must define the 'output' field in the returned table as a number or a "
"float array!");
stateData.knownBadFunctions.insert(s->funcName);
s->isvalid = false;
};
Expand Down Expand Up @@ -724,7 +724,7 @@ void valueAt(int phaseIntPart, float phaseFracPart, SurgeStorage *storage,
{
s->isvalid = false;
std::ostringstream oss;
oss << "Failed to evaluate 'process' function." << lua_tostring(s->L, -1);
oss << "Failed to evaluate the process() function!" << lua_tostring(s->L, -1);
s->adderror(oss.str());
lua_pop(s->L, 1);
return;
Expand Down Expand Up @@ -836,7 +836,7 @@ std::vector<DebugRow> createDebugDataOfModState(const EvaluatorState &es)
if (!lua_istable(es.L, -1))
{
lua_pop(es.L, -1);
rows.emplace_back(0, "Error", "Not a Table");
rows.emplace_back(0, "Error", "Not a table");
continue;
}
rec(0, false);
Expand Down
8 changes: 4 additions & 4 deletions src/surge-testrunner/UnitTestsLUA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ TEST_CASE("Surge Prelude", "[lua]")
auto pcall = lua_pcall(L, 0, 1, 0);
if (pcall != 0)
{
std::cout << "Lua Error[" << pcall << "] " << lua_tostring(L, -1) << std::endl;
INFO("Lua Error " << pcall << " " << lua_tostring(L, -1));
std::cout << "Lua error [" << pcall << "] " << lua_tostring(L, -1) << std::endl;
INFO("Lua error " << pcall << " " << lua_tostring(L, -1));
}

REQUIRE(lua_isnumber(L, -1));
Expand Down Expand Up @@ -318,7 +318,7 @@ end
REQUIRE(!res);
REQUIRE(lua_gettop(L) == 1);
REQUIRE(lua_isnil(L, -1));
REQUIRE(err == "Lua Syntax Error: [string \"lua-script\"]:7: 'end' expected (to close "
REQUIRE(err == "Lua syntax error: [string \"lua-script\"]:7: 'end' expected (to close "
"'function' at line 2) near '<eof>'");
lua_pop(L, 1);
lua_close(L);
Expand All @@ -341,7 +341,7 @@ error("I will parse but will not run")
REQUIRE(lua_gettop(L) == 1);
REQUIRE(lua_isnil(L, -1));
REQUIRE(err ==
"Lua Evaluation Error: [string \"lua-script\"]:3: I will parse but will not run");
"Lua evaluation error: [string \"lua-script\"]:3: I will parse but will not run");
lua_pop(L, 1);
lua_close(L);
}
Expand Down
4 changes: 2 additions & 2 deletions src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ void OscillatorWaveformDisplay::populateMenu(juce::PopupMenu &contextMenu, int s
});
};
if (isWav)
xportMenu.addItem(Surge::GUI::toOSCase("To RIFF/WAV Wavetable..."), exportAction);
xportMenu.addItem("To .WAV...", exportAction);
else
xportMenu.addItem(Surge::GUI::toOSCase("To WT Format Wavetable..."), exportAction);
xportMenu.addItem("To .WT...", exportAction);
}
contextMenu.addSubMenu("Export Wavetable", xportMenu);

Expand Down

0 comments on commit d5f4d5c

Please sign in to comment.