GetPackageName: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server & Client|1.0}} {{FuncDescription|Get name of the package from where this function is called from.}} {{FuncSyntax|GetPackageName()}} {{FuncParameters}..." |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
{{FuncNoParam}} | {{FuncNoParam}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns the package name as a string.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
function OnPackageStart() | |||
WebGuiId = CreateWebUI(0.0, 0.0, 0.0, 0.0, 4, 32) | |||
LoadWebFile(WebGuiId, "http://asset/"..GetPackageName().."/gui/gui.html") | |||
SetWebAlignment(WebGuiId, 0.0, 0.0) | |||
SetWebAnchors(WebGuiId, 0.0, 0.0, 1.0, 1.0) | |||
SetWebVisibility(WebGuiId, WEB_HITINVISIBLE) | |||
end | |||
AddEvent("OnPackageStart", OnPackageStart) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
*[[ImportPackage]] | |||
*[[StartPackage]] | |||
*[[StopPackage]] | |||
*[[GetAllPackages]] | |||
*[[GetPackageName]] | |||
*[[IsPackageStarted]] | |||
*[[GetPackageFiles]] |
Latest revision as of 17:12, 30 December 2020
Description
Get name of the package from where this function is called from.
Syntax
GetPackageName()
Parameters
- This function has no parameters.
Return Value
- Returns the package name as a string.
Example
function OnPackageStart()
WebGuiId = CreateWebUI(0.0, 0.0, 0.0, 0.0, 4, 32)
LoadWebFile(WebGuiId, "http://asset/"..GetPackageName().."/gui/gui.html")
SetWebAlignment(WebGuiId, 0.0, 0.0)
SetWebAnchors(WebGuiId, 0.0, 0.0, 1.0, 1.0)
SetWebVisibility(WebGuiId, WEB_HITINVISIBLE)
end
AddEvent("OnPackageStart", OnPackageStart)