-
-
Notifications
You must be signed in to change notification settings - Fork 9
include
Jérôme Leclercq edited this page Dec 8, 2020
·
2 revisions
API: include
Loads and execute a file from its path.
An error occurring during loading will trigger an error in the script executing include
.
include
(path: string
)
-
asset
: Path to the file (relative to the current file).
-
Only scripts registered using RegisterClientScript server-side can be included client-side. If a client script tries to include a non-registered script file it will not be found by the game (independently of the file existence on the dive).
A simple shared.lua entity using a custom asset
-- Registers the script client-side
RegisterClientScript()
-- Registers box.png as a client-side asset
RegisterClientAssets("box.png")
if (CLIENT) then
entity:On("init", function (self)
self:AddSprite({
-- Using the asset
TexturePath = "box.png"
})
end)
end