forked from mafia2online/Module-MySQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDK.cpp
More file actions
40 lines (31 loc) · 878 Bytes
/
Copy pathSDK.cpp
File metadata and controls
40 lines (31 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*************************************************************
*
* Solution : Mafia 2 Multiplayer
* Project : Software Development Kit
* File : SDK.cpp
*
***************************************************************/
#include "SDK.h"
SquirrelInterface_t Squirrel;
CCoreInterface * pCore;
EXPORT void SetupSquirrel( SquirrelInterface_t * SquirrelInterface )
{
Squirrel = *SquirrelInterface;
}
EXPORT void SetupCore( CCoreInterface * pCoreInterface )
{
pCore = pCoreInterface;
}
void RegisterFunction( HSQUIRRELVM vm, const char * szFunctionName, SQFUNCTION pfnFunction )
{
// Push the root table onto the stack
sq_pushroottable( vm );
// Push the function name
sq_pushstring( vm, szFunctionName, -1 );
// Create a new clossure
sq_newclosure( vm, pfnFunction, 0 );
// Create a new slot
sq_createslot( vm, -3 );
// Pop the stack
sq_pop( vm, 1 );
}