Note that it is good practice to identify data items by the script that creates them. Consider the keys to be Globals and prefix them with a unique identifier MyScriptID -- e.g. for the hayasidist utility function the prefix might be HS_Utility_ and keys named such as HS_Utility_Int Value.
local ScriptInfo = moho.layer:ScriptData()
ScriptInfo:Set("MyScriptID_Int Value", 42)
ScriptInfo:Set("MyScriptID_Bool Value", true)
ScriptInfo:Set("MyScriptID_StringName", "This is a saved string.")
local v = LM.Vector2:new_local()
v:Set(5.6, 7.8)
ScriptInfo:Set("MyScriptID_Saved Vector2", v)
local v = LM.Vector3:new_local()
v:Set(3.4, 5.6, 7.8)
ScriptInfo:Set("MyScriptID_Saved Vector3", v)
if (ScriptInfo:HasKey("MyScriptID_Saved Vector3")) then
local v = ScriptInfo:GetVector3("MyScriptID_Saved Vector3")
print(v.x, v.y, v.z)
end
print("Layer Script Data")
for i = 0, ScriptInfo:CountKeys() - 1 do
local keyName = ScriptInfo:GetKeyName(i)
print(keyName, ScriptInfo:GetString(keyName))
end
String "ScriptData" is found in the following scripts: