Skip to content

Commit

Permalink
Performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 committed Jul 23, 2024
1 parent ea42cb3 commit 4aba6f7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lua/starfall/sflib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1313,10 +1313,18 @@ do
local ss = SF.StringStream(str)
local tableLookup = {}

local function stringToType()
local t = ss:readUInt8()
local val = (stringtotypefuncs[t] or error("Invalid type " .. t))(ss)
return instance and instance.WrapObject(val) or val
local stringToType
if instance then
function stringToType()
local t = ss:readUInt8()
local val = (stringtotypefuncs[t] or error("Invalid type " .. t))(ss)
return instance.WrapObject(val) or val
end
else
function stringToType()
local t = ss:readUInt8()
return (stringtotypefuncs[t] or error("Invalid type " .. t))(ss)
end
end

stringtotypefuncs[TYPE_TABLE] = function(ss)
Expand Down

0 comments on commit 4aba6f7

Please sign in to comment.