summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/luaengine.h
blob: 2ce3872396b907494833325b589bb6fe49b0aa08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************

    luaengine.h

    Controls execution of the core MAME system.

***************************************************************************/

#pragma once

#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif

#ifndef __LUA_ENGINE_H__
#define __LUA_ENGINE_H__

struct lua_State;

class lua_engine
{
public:
	// construction/destruction
	lua_engine(running_machine &machine);
	~lua_engine();

	// getters
	running_machine &machine() const { return m_machine; }

	void initialize();
	void lua_execute();
	void report_errors(int status);

	void createvm();
	void execute(const char *filename);
	void execute_string(const char *value);
	void close();

	//static
	static int emu_gamename(lua_State *L);
	static int emu_keypost(lua_State *L);
private:
	// internal state
	running_machine &   m_machine;                          // reference to our machine
	lua_State*          m_lua_state;

	static lua_engine*  luaThis;
};

#endif  /* __LUA_ENGINE_H__ */