#problem is I'm so new, I'm not sure
1 messages · Page 1 of 1 (latest)
So tts is fairly lax with what it actually accepts. Right now, the linter is more strict than it has to be (I am working on fixing this everywhere, which has to be done manually).
When an argument should be a vector or a color, you can actually pass in a few different things that are all acceptable.
For color, you can pass in a string, e.g. 'Red' that is one of the player colors (or a color you have defined with Color.Add).
You can also pass in a table that is either indexed, e.g. {0.5, 0.5, 0.5}, or named, e.g. {r=0.5, g=0.5, b=0.5}.
Finally, you can pass in a Color object, that can be created in basically the same ways
e.g. Color(0.5, 0.5, 0.5), Color({0.5, 0.5, 0.5}), etc.
For clarity, it's always best to just use Color(r, g, b, a) form (in my humble opinion).
At first I was going to use your library as the Addon in Semneko. I've since switch to using your repo directly and this in my VSCode workspace:
"Lua.workspace.library": [
"E:/dev/TTS/TTSLua/library",
],
It allows me to play with and change/add some of the things that are missing.
Yeah that's definitely the better way of doing it
The only real difference is that you aren't notified of updates
Although you can also edit the code in the repo even if you use the Addon
I can always do a git pull right? I'm assuming I'll get your changes.
Yeah you will
So for this is something I'm playing with:
diff --git a/library/Color.lua b/library/Color.lua
index e62a7b1..420c48b 100644
--- a/library/Color.lua
+++ b/library/Color.lua
---# Color
+---@alias tts__CharColorShape {r: number, g: number, b: number, a: number}
+---@alias tts__NumColorShape {0: number, 1: number, 2: number, 3: number}
+---@alias tts__Color Color|tts__CharColorShape|tts__NumColorShape
---Color is a type of Table that is used to define RGBA values for tinting. R for red,
I couldn't get Discord to send my git diff
It's the 3 aliases for Color
I thought I made a change to Base too, but I seem to have lost it.
---@field public list string[]
---@overload fun(r?: float, g?: float, b?: float, a?: float):Color
---@overload fun(v: float[]):Color
Color = {}
This is what it is right now. I have to make my own alias for Color
or maybe I changed it deep in the bowels of %APPDATA%
(which I how I started changing things, then decided to use your repo directly)
Haha yeah
I'm working on identifying the methods that have optional arguments that aren't marked as optional
There's a few of those. Some that I missed, and others that TTS doesn't have listed as optional that actually are.
I LOVE it. And the occasional links to the docs especially
Good, I'm glad!
I've been trying to figure out how to get the add on to figure out that self is always of type Object unless the script is named Global.-1.lua
Well, I can't get require("Global.-1") to work either, so I gave up and renamed it.
I saw this in your config:
"files": ["Global%.%-1%.lua", ".+%.[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]%.lua$"],
but I couldn't get it to give me any different behavior.
That's just for the Add-On to be suggested to be enabled when someone with sumneko's lsp is writing files. It doesn't change anything if you have it already
ah
So if it detects a file matching that pattern, it'll suggest that you enable the addon for the project
Also, what does this do, it's not what I would expect, but I really don't know what to expect.
"Lua.runtime.builtin": {
"basic": "disable",
"builtin": "disable",
"math": "enable",
"bit": "disable",
"bit32": "enable",
"coroutine": "enable",
"os": "disable",
"debug": "disable",
"ffi": "disable",
"io": "disable",
"jit": "disable",
"package": "disable",
"string": "disable",
"table": "enable",
"table.clear": "disable",
"table.new": "disable",
"utf8": "disable"
},
Ah. So this is where I control what builtin lua modules are automatically considered to be linted.
Since TTS does not enable all lua modules, (and for some, it uses a slightly different version as it is based on Moonsharp and not actual lua), I disable some.
e.g., some parts of os are in TTS, but most aren't (since TTS doesn't support file IO for obvious reasons)
Yeah, I was comparing it to this list when I saw it:
https://api.tabletopsimulator.com/lua-in-tabletop-simulator/#lua-standard-libraries
Yeah. The "basic" module in sumneko's LSP has some differences with what TTS uses, for instance.
Same with "String"
In your original post you mentioned something called "Lua ls" I think. What is that? I'm using Console++, and there is an ls command in that, but I wasn't sure if it was the same or different.
Lua LS is the Lua language server from sumneko. It's what powers the TTSLua plugin
LS = Language Server
okay, cool. Thanks for following up. I am liking Sumneko, better than EmmyLua. Especially with your TTSLua.
Have you looked at the one by Ben Dobell? I was considering trying to compare and merge.