Voltaism Dev Tips: Difference between revisions
From Onset Developer Wiki
No edit summary |
added first server tip |
||
Line 1: | Line 1: | ||
WIP | '''WIP''' | ||
== Serverside Tips == | == Serverside Tips == | ||
==== Restart self using an exported function ==== | |||
'''Package 1:''' | |||
<syntaxhighlight lang="Lua"> | |||
function RestartPackage(package_name) | |||
Delay(1, function() | |||
StopPackage(package_name) | |||
end) | |||
Delay(1000, function() | |||
StartPackage(package_name) | |||
end) | |||
return true | |||
end | |||
AddFunctionExport("RestartPackage", RestartPackage) | |||
</syntaxhighlight> | |||
'''Package 2:''' | |||
<syntaxhighlight lang="Lua"> | |||
local package1 = ImportPackage("package1") | |||
package1.RestartPackage(GetPackageName()) | |||
</syntaxhighlight> | |||
== Clientside Tips == | == Clientside Tips == |
Revision as of 18:27, 6 July 2021
WIP
Serverside Tips
Restart self using an exported function
Package 1:
function RestartPackage(package_name)
Delay(1, function()
StopPackage(package_name)
end)
Delay(1000, function()
StartPackage(package_name)
end)
return true
end
AddFunctionExport("RestartPackage", RestartPackage)
Package 2:
local package1 = ImportPackage("package1")
package1.RestartPackage(GetPackageName())