Makes a function public. A public function can be called from other scripts.
Code cpp:
VAULTSCRIPT vaultmp::Void (*MakePublic)(vaultmp::Function, vaultmp::String, vaultmp::String);
native MakePublic(const func{}, const name{}, const def{});
vaultmp::Function (C++ only) - the function
func (PAWN only) - the name of the function
name - the public name of the function (must be unique)
def - the parameter list of the function. This is a string containing a sequence of:
- i - Integer (4 byte)
- l - Long integer (8 byte)
- f - Floating-point (8 byte)
- p - Pointer (4 byte)
- s - String (const char*)
None.
Code cpp:
vaultmp::Result VAULTSCRIPT MyPublic(unsigned int a, unsigned int b, const char* c)
{
// Public function
return (a + b);
}
vaultmp::Void VAULTSCRIPT exec()
{
MakePublic(reinterpret_cast<Function>(&MyPublic), "MagicFunction", "iis");
}
Code c:
forward MyPublic(a, b, const c{});
public MyPublic(a, b, const c{})
{
// Public function
return (a + b);
}
main()
{
MakePublic("MyPublic", "MagicFunction", "iis");
}