1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-15 22:57:12 +02:00

Improve the client script data event. Also fix a crash because the buffer type was not registered.

This commit is contained in:
Sandu Liviu Catalin
2016-06-20 18:02:44 +03:00
parent 29abf2e9c0
commit ea70a21437
3 changed files with 29 additions and 57 deletions

View File

@ -11,56 +11,6 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------
extern void Register_BufferInterpreter(Table & bns);
// ------------------------------------------------------------------------------------------------
Object CreateBufferWrapperCopy(const Buffer & b)
{
// Attempt to create the requested buffer
try
{
// Remember the current stack size
const StackGuard sg;
// Transform the pointer into a script object
PushVar< const BufferWrapper & >(DefaultVM::Get(), BufferWrapper(b));
// Get the object from the stack and return it
return Var< Object >(DefaultVM::Get(), -1).value;
}
catch (const Sqrat::Exception & e)
{
throw e; // Re-throw
}
catch (const std::exception & e)
{
STHROWF("%s", e.what()); // Re-package
}
// Shouldn't really reach this point
return NullObject();
}
// ------------------------------------------------------------------------------------------------
Object CreateBufferWrapperMove(Buffer && b)
{
// Attempt to create the requested buffer
try
{
// Remember the current stack size
const StackGuard sg;
// Transform the pointer into a script object
PushVar< const BufferWrapper & >(DefaultVM::Get(), BufferWrapper(std::move(b)));
// Get the object from the stack and return it
return Var< Object >(DefaultVM::Get(), -1).value;
}
catch (const Sqrat::Exception & e)
{
throw e; // Re-throw
}
catch (const std::exception & e)
{
STHROWF("%s", e.what()); // Re-package
}
// Shouldn't really reach this point
return NullObject();
}
// ------------------------------------------------------------------------------------------------
Object BufferWrapper::Create(SzType n)
{