-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
googer_ edited this page Nov 30, 2024
·
3 revisions
Thorium is built to work with multiple addons. When your addon needs thorium, use require to load thorium in your addon. It will be only loaded once, even if require is called multiple times.
Thorium should be treated as an addon you simply add to your collection to minimize amount of lua files sent to client. However, Thorium can be included in your own addon as well by building a non-conflicting "namespaced" version of it and including it instead.
Add require("thorium") at the top of your file to request thorium loading:
require("thorium")
Log("Thorium started!")
-- ...our code there...Most of functions and variables in Thorium starts with thorium. infront.
For example:
local buffer = thorium.gbuffer.New()
buffer:WriteUInt(32767)
buffer:WriteStringNT("hello, world")
thorium.file.Write("test.txt", buffer)
Log("lua/autorun/thorium_init.lua is located in addon \"%s\"", thorium.file.WhereIs("lua/autorun/thorium_init.lua"))