Skip to content

Commit

Permalink
Add set_custom_type_with_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Srlion committed Dec 15, 2024
1 parent 93a5494 commit b0d9ba7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sfs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,16 @@ return {
return CUSTOM_START - 1
end,

set_custom_type_with_id = function(id, typ, encoder, decoder)
if encoders[typ] or decoders[typ] then
-- this just prints incase you mistakenly add a type that already exists
ErrorNoHaltWithStack("type already exists: `" .. typ .. "`")
end

encoders[typ] = encoder
decoders[id] = decoder
end,

chars = chars,
VERSION = "3.0.6"
}

0 comments on commit b0d9ba7

Please sign in to comment.