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

MakePublic

This is an old revision of this page, as edited 04-06-2012, 03:24 PM by foxtacles (contribs). It may differ significantly from the current revision.
Makes a function public. A public function can be called from other scripts.

[top]Declaration

<code cpp>
VAULTSCRIPT void (*MakePublic)(vaultmp::Function, std::string, std::string);
native MakePublic(const func{}, const name{}, const def{});
</code>

[top]Parameters

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)
  • s - String (const char*)

[top]Return value

None.

[top]Usage example (C++)

<code cpp>
vaultmp::Result VAULTSCRIPT MyPublic(unsigned int a, unsigned int b, const char* c)
{
// Public function
return (a + b);
}
void VAULTSCRIPT exec()
{
MakePublic(reinterpret_cast<Function>(&MyPublic), "MagicFunction", "iis");
}
</code>

[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");
}
</code>

[top]Related pages