- LuaParam processed
This commit is contained in:
parent
0e0490eafb
commit
4cdb7e2c6a
@ -387,6 +387,7 @@ class Game extends AutoStoring
|
|||||||
"image_data" => $select_fn(["Kép", "Image"]),
|
"image_data" => $select_fn(["Kép", "Image"]),
|
||||||
"question" => $select_fn(["Kérdés", "Question"]),
|
"question" => $select_fn(["Kérdés", "Question"]),
|
||||||
"lua_script" => $select_fn(["Lua"]),
|
"lua_script" => $select_fn(["Lua"]),
|
||||||
|
"lua_params" => Utils::str2kv($select_fn(["LuaParam"])),
|
||||||
];
|
];
|
||||||
|
|
||||||
// convert into
|
// convert into
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class Task implements JsonSerializable
|
|||||||
private string $lua_script; // path to the corresponding Lua script
|
private string $lua_script; // path to the corresponding Lua script
|
||||||
private Game|Test|null $governor; // object that governs this task
|
private Game|Test|null $governor; // object that governs this task
|
||||||
private LuaSandbox|null $lua_sandbox; // Lua sandbox, initially NULL
|
private LuaSandbox|null $lua_sandbox; // Lua sandbox, initially NULL
|
||||||
|
private array $lua_params; // Lua script parameters
|
||||||
|
|
||||||
// -------------
|
// -------------
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ class Task implements JsonSerializable
|
|||||||
$this->player_answer = $a["player_answer"] ?? null;
|
$this->player_answer = $a["player_answer"] ?? null;
|
||||||
$this->correct_answer = $a["correct_answer"] ?? null;
|
$this->correct_answer = $a["correct_answer"] ?? null;
|
||||||
$this->lua_script = $a["lua_script"] ?? "";
|
$this->lua_script = $a["lua_script"] ?? "";
|
||||||
|
$this->lua_params = $a["lua_params"] ?? [];
|
||||||
|
|
||||||
$this->governor = null;
|
$this->governor = null;
|
||||||
$this->lua_sandbox = null;
|
$this->lua_sandbox = null;
|
||||||
@ -151,6 +153,7 @@ class Task implements JsonSerializable
|
|||||||
$a["is_template"] = $this->is_template;
|
$a["is_template"] = $this->is_template;
|
||||||
$a["flags"] = $this->flags;
|
$a["flags"] = $this->flags;
|
||||||
$a["lua_script"] = $this->lua_script;
|
$a["lua_script"] = $this->lua_script;
|
||||||
|
$a["lua_params"] = $this->lua_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isTemplate()) {
|
if (!$this->isTemplate()) {
|
||||||
@ -200,6 +203,14 @@ class Task implements JsonSerializable
|
|||||||
return $this->lua_script;
|
return $this->lua_script;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLuaParams(): array {
|
||||||
|
return $this->lua_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLuaParams(array $lua_params): void {
|
||||||
|
$this->lua_params = $lua_params;
|
||||||
|
}
|
||||||
|
|
||||||
function getPlayerAnswer(): mixed {
|
function getPlayerAnswer(): mixed {
|
||||||
return $this->player_answer;
|
return $this->player_answer;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user