mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 06:07:56 +03:00
Making vscript print consistent, adding printl
This commit is contained in:
parent
d657e2b713
commit
897534aec6
@ -1088,17 +1088,18 @@ void printfunc(HSQUIRRELVM SQ_UNUSED_ARG(v), const SQChar* format, ...)
|
|||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
vsprintf(buffer, format, args);
|
vsprintf(buffer, format, args);
|
||||||
Msg("vscript: %s\n", buffer);
|
Msg("%s", buffer);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void errorfunc(HSQUIRRELVM SQ_UNUSED_ARG(v), const SQChar* format, ...)
|
void errorfunc(HSQUIRRELVM SQ_UNUSED_ARG(v), const SQChar* format, ...)
|
||||||
{
|
{
|
||||||
|
// NOTE: This is only separate from printfunc to make it easier to add breakpoints
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
vsprintf(buffer, format, args);
|
vsprintf(buffer, format, args);
|
||||||
Msg("vscript: (ERRORR) %s\n", buffer);
|
Msg("%s", buffer);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1143,40 +1144,48 @@ bool SquirrelVM::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Run(
|
if (Run(
|
||||||
"class CSimpleCallChainer\n"
|
R"script(
|
||||||
"{\n"
|
function printl( text )
|
||||||
" function constructor(prefixString, scopeForThis, exactMatch)\n"
|
{
|
||||||
" {\n"
|
return print(text + "\n");
|
||||||
" prefix = prefixString;\n"
|
}
|
||||||
" scope = scopeForThis;\n"
|
|
||||||
" chain = [];\n"
|
class CSimpleCallChainer
|
||||||
" scope[\"Dispatch\" + prefixString] <- Call.bindenv(this);\n"
|
{
|
||||||
" }\n"
|
function constructor(prefixString, scopeForThis, exactMatch)
|
||||||
"\n"
|
{
|
||||||
" function PostScriptExecute()\n"
|
prefix = prefixString;
|
||||||
" {\n"
|
scope = scopeForThis;
|
||||||
" local func = null;\n"
|
chain = [];
|
||||||
" try {\n"
|
scope["Dispatch" + prefixString] <- Call.bindenv(this);
|
||||||
" func = scope[prefix];\n"
|
}
|
||||||
" } catch(e) {\n"
|
|
||||||
" return;\n"
|
function PostScriptExecute()
|
||||||
" }\n"
|
{
|
||||||
" if (typeof(func) != \"function\")\n"
|
local func = null;
|
||||||
" return;\n"
|
try {
|
||||||
" chain.push(func);\n"
|
func = scope[prefix];
|
||||||
" }\n"
|
} catch(e) {
|
||||||
"\n"
|
return;
|
||||||
" function Call()\n"
|
}
|
||||||
" {\n"
|
if (typeof(func) != "function")
|
||||||
" foreach (func in chain)\n"
|
return;
|
||||||
" {\n"
|
chain.push(func);
|
||||||
" func.pcall(scope);\n"
|
}
|
||||||
" }\n"
|
|
||||||
" }\n"
|
function Call()
|
||||||
" prefix = null;\n"
|
{
|
||||||
" scope= null;\n"
|
foreach (func in chain)
|
||||||
" chain = [];\n"
|
{
|
||||||
"}") != SCRIPT_DONE)
|
func.pcall(scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prefix = null;
|
||||||
|
scope= null;
|
||||||
|
chain = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
)script") != SCRIPT_DONE)
|
||||||
{
|
{
|
||||||
this->Shutdown();
|
this->Shutdown();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user