forked from ValveSoftware/source-sdk-2013
-
Notifications
You must be signed in to change notification settings - Fork 152
Labels
BugSomething isn't workingSomething isn't workingVScriptMapbase - Involves VScriptMapbase - Involves VScript
Description
Describe the bug
Failed serialisation of SQFunctionProto::_literals
in VScript VM. SQFunctionProto::Save()
returns false for WriteObject(v,up,write,_literals[i])
where it cannot write other than primitive types (string, bool, integer, float).
Literals are compiled values that run the _OP_LOAD
, _OP_LOADFLOAT
, _OP_LOADINT
instructions. And any variables in the const table are compiled in.
This does not necessarily have to crash the game though. Error()
fail case is not necessary, and it can be changed to an assert, warning while clearing the saved data.
Steps to reproduce
- Place an instance/closure in the const table. Instance type (native or not) does not matter.
getconsttable().INSTANCE <- function(){}
- Make a closure that accesses a constant instance
function fn() { INSTANCE }
- Save the game (and the closure)
Additional context
Workaround:
local K = INSTANCE;
function fn() { K }
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingVScriptMapbase - Involves VScriptMapbase - Involves VScript