Client Difference Log
API Changes
Added Property string PlayerEmulatorService.DEPRECATED_SerializedEmulatedPolicyInfo {RobloxScriptSecurity} [Hidden]
Changed the category of Property BasePart.CustomPhysicalProperties
from: "Part "
to: "Part"
Changed the category of Property BasePart.Elasticity
from: "Part "
to: "Part"
Changed the category of Property BasePart.Friction
from: "Part "
to: "Part"
Changed the category of Property BasePart.ReceiveAge
from: "Part "
to: "Part"
Changed the category of Property BasePart.RootPriority
from: "Part "
to: "Part"
Changed the category of Property BasePart.Size
from: "Part "
to: "Part"
Changed the category of Property FormFactorPart.FormFactor
from: "Part "
to: "Part"
Changed the category of Property Part.Shape
from: "Part "
to: "Part"
Changed the category of Property TrussPart.Style
from: "Part "
to: "Part"
Changed the security and value-type of Property PlayerEmulatorService.SerializedEmulatedPolicyInfo
from: {RobloxScriptSecurity} string
to: {RobloxSecurity} BinaryString
(Click here for a syntax highlighted version!)
Is there a functionality difference between RobloxSecurity
and RobloxScriptSecurity
? Or does it mean something else?
It is a higher security tag than RobloxScriptSecurity.
Uh oh. I never got into the habit of using tostring assuming that this behaviour would be permanent.
Are there any specific cases where this new print behaviour may throw different or unexpected results than now or where it may error? As far as Iâm aware all my old crusty code prints pretty much every Lua datatype except for function. Nothing should break (and even if it does, well, it doesnât matter).
Approximately how small are we talking and would this improvement be considered negligible or significantly better? Additionally, could this margin be bumped up by using table.create to preallocate the tableâs size if you arenât prefilling it with elements?
print
will no longer call the tostring
global function, but does something equivalent to the default tostring
function. Basically setting to the global tostring
will no longer affect print
(because it doesnât look at the environment to get the tostring
function).
tostring = function()return"2"end
print"1" -- used to print 2, now prints 1
I donât think this is a breaking change, the Lua 5.1 manual states
print (¡¡¡)
Receives any number of arguments, and prints their values tostdout
, using thetostring
function to convert them to strings.string.format
.
using the tostring function
doesnât imply if it calls the tostring
function by getting the global or by getting it stored somewhere else (that isnât modifiable by Lua code).
RobloxScriptSecurity = only Roblox scripts can access it, RobloxSecurity = no scripts can access it at all, it only exists for use by the C++ code in replication / serialization.
This is amazing for one of my current projects.
At the moment Iâve had to get around this using coroutines which is a really ugly hack. (Itâs already a really ugly hack to be fair since Iâm modifying fenvs a lot but still, happy to see this) Iâm curious to know if this might positively impact performance when using lots of print calls.
I am also very excited about this:
Is this faster than using normal ânewindexingâ?
local list = table.create(5)
table.insert(list, "abc")
-- vs
local list = table.create(5)
list[#list + 1] = "abc"
And which of the below would be faster?
local list = table.create(5)
table.insert(list, knownIndex, "abc")
-- vs
list[knownIndex] = "abc"
Iâm wondering if table.insert
is able to achieve better performance or might in the future because I might use any of the above and usually they can be switched out easily, so, knowing which should be used for performance would be really useful to me.
Thought Iâd mention this here, print
no longer using the global tostring
also applies to warn
which isnât mentioned here. error
doesnât use the same mechanism and treats non numeric/string values like nil
from what I could tell which I think is the same behaviour as before the update, so, it doesnât access the global tostring
before or after this change.
This makes debugging a lot of my sandbox work much easier going forward which I am happy about.
error
works fine with non numeric/string values for me
local s,r = pcall(error,{x=1})
print(s) --> false
print(r.x) --> 1
Also, why would error
ever call tostring
? error
doesnât output anything (something else prints the error).
Nothing is wrong with error
, thatâs not what I was saying. I was just pointing out that it doesnât use the same mechanism as print
/warn
and doesnât use tostring
for non string values. It still does string conversion, e.g. for number values.
Technically error
doesnât output anything but the mechanism that does output something is still doing string conversion since number values show up fine, that, or error
is doing string conversion before emitting the error. That mechanism doesnât rely on the global tostring
, which is what I was saying, and, thatâs how I recall it working before this update.
This is what he means:
local x = {}
setmetatable(x, {__tostring = function() return "foo" end})
print(x) --> foo
error(x) --> Error occurred, no output from Lua.
You are correct. I always forget warn
exists.
error
by itself can work with any error type. What you will see though is that in some Roblox code that interfaces with Luau, errors are expected to be strings, e.g. the top-level code that runs scripts wants to print an error to standard output and only supports strings at the moment. But if you use pcall/etc. this doesnât impact your ability to catch errors of the correct type.
table.insert
is the preferred alternative to t[#t + 1] = v
. Itâs a bit faster.
When you know the index already, you should use list[index] = v
; table.insert
with an index shifts the entire trailing portion of the table by 1, which isnât particularly fast, but itâs fundamentally a different operation. If you need to do that then table.insert
is the fastest way to do that, but if you donât you should just assign the value.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.