3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /******************************************************************************/
22 /******************************************************************************/
23 /* WARNING!!!! do NOT add this header in any include file or any code file */
24 /* not being a script/modapi file!!!!!!!! */
25 /******************************************************************************/
26 /******************************************************************************/
27 #ifndef C_CONVERTER_H_
28 #define C_CONVERTER_H_
33 #include "irrlichttypes_bloated.h"
34 #include "common/c_types.h"
40 std::string getstringfield_default (lua_State *L, int table,
41 const char *fieldname, const std::string &default_);
42 bool getboolfield_default(lua_State *L, int table,
43 const char *fieldname, bool default_);
44 float getfloatfield_default(lua_State *L, int table,
45 const char *fieldname, float default_);
46 int getintfield_default (lua_State *L, int table,
47 const char *fieldname, int default_);
49 bool getstringfield(lua_State *L, int table,
50 const char *fieldname, std::string &result);
51 bool getintfield(lua_State *L, int table,
52 const char *fieldname, int &result);
53 void read_groups (lua_State *L, int index,
54 std::map<std::string, int> &result);
55 bool getboolfield(lua_State *L, int table,
56 const char *fieldname, bool &result);
57 bool getfloatfield(lua_State *L, int table,
58 const char *fieldname, float &result);
60 std::string checkstringfield(lua_State *L, int table,
61 const char *fieldname);
63 void setintfield(lua_State *L, int table,
64 const char *fieldname, int value);
65 void setfloatfield(lua_State *L, int table,
66 const char *fieldname, float value);
67 void setboolfield(lua_State *L, int table,
68 const char *fieldname, bool value);
71 v3f checkFloatPos (lua_State *L, int index);
72 v3f check_v3f (lua_State *L, int index);
73 v3s16 check_v3s16 (lua_State *L, int index);
75 v3f read_v3f (lua_State *L, int index);
76 v2f read_v2f (lua_State *L, int index);
77 v2s16 read_v2s16 (lua_State *L, int index);
78 video::SColor readARGB8 (lua_State *L, int index);
79 aabb3f read_aabb3f (lua_State *L, int index, f32 scale);
80 v3s16 read_v3s16 (lua_State *L, int index);
82 read_aabb3f_vector (lua_State *L, int index, f32 scale);
84 void push_v3s16 (lua_State *L, v3s16 p);
85 void pushFloatPos (lua_State *L, v3f p);
86 void push_v3f (lua_State *L, v3f p);
87 void push_v2f (lua_State *L, v2f p);
91 void warn_if_field_exists (lua_State *L,
93 const char *fieldname,
94 const std::string &message);
96 #endif /* C_CONVERTER_H_ */