Voltaism Dev Tips: Difference between revisions
From Onset Developer Wiki
added first server tip |
add tip |
||
Line 3: | Line 3: | ||
== Serverside Tips == | == Serverside Tips == | ||
==== Restart self using an exported function ==== | ==== SV1) Restart self using an exported function ==== | ||
'''Package 1:''' | '''Package 1:''' | ||
<syntaxhighlight lang="Lua"> | <syntaxhighlight lang="Lua"> | ||
Line 25: | Line 25: | ||
== Clientside Tips == | == Clientside Tips == | ||
== Global/Other Tips == | |||
==== G1) Call/Edit a function/variable with a string ==== | |||
<syntaxhighlight lang="Lua"> | |||
_ENV["function_" .. "test"] = function(nb) | |||
print("Hi", nb) | |||
end | |||
function_test(0) | |||
_ENV["function_test"](1) | |||
_ENV["vartest"] = 1 | |||
print(vartest) | |||
print(_ENV["vartest"]) | |||
</syntaxhighlight> |
Revision as of 19:00, 6 July 2021
WIP
Serverside Tips
SV1) 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())
Clientside Tips
Global/Other Tips
G1) Call/Edit a function/variable with a string
_ENV["function_" .. "test"] = function(nb)
print("Hi", nb)
end
function_test(0)
_ENV["function_test"](1)
_ENV["vartest"] = 1
print(vartest)
print(_ENV["vartest"])