mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Improve the client script data event. Also fix a crash because the buffer type was not registered.
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user