-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuaSF.cpp.in
More file actions
63 lines (52 loc) · 1.3 KB
/
Copy pathLuaSF.cpp.in
File metadata and controls
63 lines (52 loc) · 1.3 KB
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
53
54
55
56
57
58
59
60
61
62
63
// This file is generated by tools/generate_build_files.py. Do not edit manually.
#include "LuaSF.hpp"
#include <LuaGlue/LuaGlue.hpp>
#include <cstdio>
#include <exception>
#include "lua_stub.hpp"
extern "C" {{
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
}}
{includes}
extern "C" LUASF_API int {module_name}_register(lua_State* state)
{{
if (state == nullptr)
{{
return 1;
}}
if (LuaSF_initialize_state(state) != 0)
{{
return 1;
}}
try
{{
lua_glue::StateView lua(state);
lua_glue::Table sf = lua["sf"].get_or_create<lua_glue::Table>();
(void)sf;
{bind_calls}
return 0;
}}
catch (const std::exception& error)
{{
std::fprintf(stderr, "{module_name} registration failed: %s\n", error.what());
return 1;
}}
catch (...)
{{
std::fprintf(stderr, "{module_name} registration failed: unknown C++ exception\n");
return 1;
}}
}}
extern "C" LUASF_API int {module_name}_write_stub(lua_State* state,
const char* path)
{{
if (state == nullptr || path == nullptr || !lua_sf::stub::begin(path))
{{
return 1;
}}
const int result = {module_name}_register(state);
lua_sf::stub::end();
return result;
}}