ScummVM API documentation
luastate.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef NANCY_SCRIPT_LUASTATE_H
23
#define NANCY_SCRIPT_LUASTATE_H
24
25
#include "common/str.h"
26
27
struct
lua_State
;
28
29
namespace
Nancy
{
30
namespace
Script {
31
32
class
SceneContext;
33
34
// A Lua interpreter with the engine's objects in it. Nancy19 and up keep all of
35
// their game data and logic in compiled Lua scripts; every script that gets run
36
// by itself (the boot files, and each scene of each stream) has a state of its own,
37
// so scripts only share what the engine keeps for them (flags, values, inventory).
38
class
LuaState
{
39
public
:
40
// The context is the scene the scripts of this state belong to, if any
41
LuaState
(
SceneContext
*context =
nullptr
);
42
~
LuaState
();
43
44
lua_State
*
get
()
const
{
return
_state; }
45
46
// Loads the script of that name and runs its main chunk. Returns false when
47
// there is no such script, or when it fails.
48
bool
runScript(
const
Common::String
&name);
49
50
// Calls the function that sits below its arguments on the stack. A failure is
51
// reported together with what was being done, and leaves no results.
52
static
bool
call(
lua_State
*L,
int
numArgs,
int
numResults,
const
char
*what);
53
54
// The scene a state was made for; null for the boot scripts
55
static
SceneContext
*getContext(
lua_State
*L);
56
57
private
:
58
lua_State
*_state;
59
};
60
61
}
// End of namespace Script
62
}
// End of namespace Nancy
63
64
#endif // NANCY_SCRIPT_LUASTATE_H
Common::String
Definition:
str.h:59
lua_State
Definition:
lstate.h:100
Nancy::Script::SceneContext
Definition:
scenecontext.h:52
Nancy::Script::LuaState
Definition:
luastate.h:38
Nancy
Definition:
actionmanager.h:32
engines
nancy
script
luastate.h
Generated on Thu Oct 22 2026 09:23:54 for ScummVM API documentation by
1.8.13