aboutsummaryrefslogtreecommitdiff
path: root/src/bitflags.h
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-06-20 22:43:06 +0200
committerGitHub <noreply@github.com>2024-06-20 22:43:06 +0200
commitc1a64c1b75f97cef97965b3bd9a941564a6270bd (patch)
treeb9a92dff6462abd5859c3c76f19748fad5d6c025 /src/bitflags.h
parent47c24eed0191f8f72646be63dee94ac2b35eb062 (diff)
parentb87e6d6d762ee823e81dd7a8984f330eb4018fd8 (diff)
downloadluasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.tar.gz
luasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.tar.bz2
luasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.zip
Merge pull request #21 from lunarmodules/terminal
Diffstat (limited to '')
-rw-r--r--src/bitflags.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bitflags.h b/src/bitflags.h
new file mode 100644
index 0000000..f16b041
--- /dev/null
+++ b/src/bitflags.h
@@ -0,0 +1,30 @@
1#ifndef LSBITFLAGS_H
2#define LSBITFLAGS_H
3
4#include <lua.h>
5#include "compat.h"
6#include <lauxlib.h>
7#include <stdlib.h>
8
9// type used to store the bitflags
10#define LSBF_BITFLAG lua_Integer
11
12// Validates that the given index is a bitflag object and returns its value.
13// If the index is not a bitflag object, a Lua error is raised.
14// The value will be left on the stack.
15LSBF_BITFLAG lsbf_checkbitflags(lua_State *L, int index);
16
17
18// Validates that the given index is a table containing a field 'fieldname'
19// which is a bitflag object and returns its value.
20// If the index is not a table or the field is not a bitflag object, a Lua
21// error is raised. If the bitflag is not present, the default value is returned.
22// The stack remains unchanged.
23LSBF_BITFLAG lsbf_checkbitflagsfield(lua_State *L, int index, const char *fieldname, LSBF_BITFLAG default_value);
24
25
26// Pushes a new bitflag object with the given value onto the stack.
27// Might raise a Lua error if memory allocation fails.
28void lsbf_pushbitflags(lua_State *L, LSBF_BITFLAG value);
29
30#endif