#trying to make my script work with --!strict
12 messages · Page 1 of 1 (latest)
i'm guessing i need to do some kind of type casting like in c like languages, idk how that works in LuaU though
you could try
local aVal : number = self:GetRI(a)
@spice wolf
but idk if that would fix the error
but at that point it's a number? not a number so that would just cause more problems
i've tried redefining the variable to be as explicit as i can but it just won't work for some reason
even local aVal: number = aVal :: number won't work
i think it has something to do with the type that was inferred from self.Reg actually, i'll try to write a type for this entire metatable lol
okay i have figured out the problem, but not the solution
when self.Reg is first defined, its type is inferred as {[string]: number}
however this function upsets this and causes it to be {[string]: number?}
so i just need to figure out how to make it, not do that, or i can just give up and use --!nonstrict instead
doesnt number? just mean that the type is not set and it just guesses what it could be?
it means that the type can be either number or nil
oh