This site has been archived and made available for preservation purposes. No edits can be made.

MakePublic

Makes a function public. A public function can be called from other scripts.

[top]Declaration

Code cpp:
VAULTSCRIPT VAULTSPACE Void (*VAULTAPI(MakePublic))(VAULTSPACE RawFunction(), VAULTSPACE cRawString, VAULTSPACE cRawString) VAULTCPP(noexcept);
Code c:
native MakePublic(const func{}, const name{}, const def{});

[top]Parameters

Function - the function
cRawString - the public name of the function (must be unique)
cRawString - 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*)

[top]Return value

None.

[top]Usage example (C++)

Code cpp:
Result VAULTSCRIPT MyPublic(unsigned int a, unsigned int b, const char* c)
{
    // Public function
    return static_cast<Result>(a + b);
}
Void VAULTSCRIPT exec() noexcept
{
    // C++ template version (type-safe, deduces type string)  
    MakePublic(MyPublic, "MagicFunction");
}

[top]Usage example (PAWN)

Code c:
forward MyPublic(a, b, const c{});
public MyPublic(a, b, const c{})
{
    // Public function
    return (a + b);
}
main()
{
    MakePublic("MyPublic", "MagicFunction", "iis");
}

[top]Related pages