mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Provide ScriptInterface CreateObject and CreateArray functions to replace Eval calls following 7c2e9027c2, 1c0536bf08 and later.
Differential Revision: https://code.wildfiregames.com/D2080 Previous version reviewed By: Krinkle Comments By: historic_bruno, wraitii This was SVN commit r22528.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -982,7 +982,8 @@ std::string CSimulation2::GetAIData()
|
||||
|
||||
// Build single JSON string with array of AI data
|
||||
JS::RootedValue ais(cx);
|
||||
if (!scriptInterface.Eval("({})", &ais) || !scriptInterface.SetProperty(ais, "AIData", aiData))
|
||||
|
||||
if (!scriptInterface.CreateObject(&ais, "AIData", aiData))
|
||||
return std::string();
|
||||
|
||||
return scriptInterface.StringifyJSON(&ais);
|
||||
|
||||
Reference in New Issue
Block a user