Haka
luautils.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef HAKA_LUA_LUAUTILS_H
6 #define HAKA_LUA_LUAUTILS_H
7 
8 #include <assert.h>
9 #include <wchar.h>
10 #include <haka/types.h>
11 
12 
13 #ifndef NDEBUG
14 
15 #define LUA_STACK_MARK(L) \
16  const int _stackmark = lua_gettop((L))
17 
18 #define LUA_STACK_CHECK(L, offset) \
19  assert(lua_gettop((L)) == _stackmark+(offset))
20 
21 #else
22 
23 #define LUA_STACK_MARK(L)
24 #define LUA_STACK_CHECK(L, offset)
25 
26 #endif
27 
28 struct lua_State;
29 
30 const char *lua_converttostring(struct lua_State *L, int idx, size_t *len);
31 bool lua_pushwstring(struct lua_State *L, const wchar_t *str);
32 
33 #endif /* HAKA_LUA_LUAUTILS_H */