summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
committerAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
commit93833069a80fe4aec33a95148df39ad40671ddaf (patch)
tree2e6a335a60e618b5fe456ca8a586a2c5448c8c87 /lib
parentReverted submodule changes. (diff)
parentMerge pull request #1528 from kjanku1/master (diff)
downloadcuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.gz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.bz2
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.lz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.xz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.zst
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.zip
Diffstat (limited to 'lib')
m---------lib/SQLiteCpp0
-rw-r--r--lib/inifile/iniFile.cpp18
-rw-r--r--lib/inifile/iniFile.h5
-rw-r--r--lib/tolua++/include/tolua++.h4
-rw-r--r--lib/tolua++/src/bin/lua/_driver.lua3
-rw-r--r--lib/tolua++/src/lib/tolua_push.c11
6 files changed, 36 insertions, 5 deletions
diff --git a/lib/SQLiteCpp b/lib/SQLiteCpp
new file mode 160000
+Subproject 55edadd56d0d6f506954ad00c3b9a5d425814a2
diff --git a/lib/inifile/iniFile.cpp b/lib/inifile/iniFile.cpp
index 2bf6c91ed..7cfe7661f 100644
--- a/lib/inifile/iniFile.cpp
+++ b/lib/inifile/iniFile.cpp
@@ -668,6 +668,24 @@ void cIniFile::Clear(void)
+bool cIniFile::HasValue(const AString & a_KeyName, const AString & a_ValueName)
+{
+ // Find the key:
+ int keyID = FindKey(a_KeyName);
+ if (keyID == noID)
+ {
+ return false;
+ }
+
+ // Find the value:
+ int valueID = FindValue(keyID, a_ValueName);
+ return (valueID != noID);
+}
+
+
+
+
+
void cIniFile::AddHeaderComment(const AString & comment)
{
comments.push_back(comment);
diff --git a/lib/inifile/iniFile.h b/lib/inifile/iniFile.h
index 58fecd0cf..33229bff0 100644
--- a/lib/inifile/iniFile.h
+++ b/lib/inifile/iniFile.h
@@ -53,7 +53,9 @@ private:
/// Removes the UTF-8 BOMs (Byte order makers), if present.
void RemoveBom(AString & a_line) const;
+
public:
+
enum errors
{
noID = -1,
@@ -79,6 +81,9 @@ public:
/// Deletes all stored ini data (but doesn't touch the file)
void Clear(void);
+
+ /** Returns true iff the specified value exists. */
+ bool HasValue(const AString & a_KeyName, const AString & a_ValueName);
/// Returns index of specified key, or noID if not found
int FindKey(const AString & keyname) const;
diff --git a/lib/tolua++/include/tolua++.h b/lib/tolua++/include/tolua++.h
index 8da427fe3..c8b654ae6 100644
--- a/lib/tolua++/include/tolua++.h
+++ b/lib/tolua++/include/tolua++.h
@@ -36,7 +36,9 @@ extern "C" {
#define TEMPLATE_BIND(p)
#endif
-#define TOLUA_TEMPLATE_BIND(p)
+#ifndef TOLUA_TEMPLATE_BIND
+ #define TOLUA_TEMPLATE_BIND(p)
+#endif
#define TOLUA_PROTECTED_DESTRUCTOR
#define TOLUA_PROPERTY_TYPE(p)
diff --git a/lib/tolua++/src/bin/lua/_driver.lua b/lib/tolua++/src/bin/lua/_driver.lua
index 87ecd42ea..1ca18862b 100644
--- a/lib/tolua++/src/bin/lua/_driver.lua
+++ b/lib/tolua++/src/bin/lua/_driver.lua
@@ -3,6 +3,9 @@
local mobdebugfound, mobdebug = pcall(require, "mobdebug")
if mobdebugfound then mobdebug.start() end
+-- Disable buffering for stdout, so that the results appear immediately:
+io.output():setvbuf("no")
+
-- The list of valid arguments that the ToLua scripts can process:
local KnownArgs = {
['v'] = true,
diff --git a/lib/tolua++/src/lib/tolua_push.c b/lib/tolua++/src/lib/tolua_push.c
index 947f0e7a5..73a5f6ec0 100644
--- a/lib/tolua++/src/lib/tolua_push.c
+++ b/lib/tolua++/src/lib/tolua_push.c
@@ -16,6 +16,7 @@
#include "../../../lua/src/lauxlib.h"
#include <stdlib.h>
+#include <assert.h>
TOLUA_API void tolua_pushvalue (lua_State* L, int lo)
{
@@ -55,12 +56,14 @@ TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
else
{
luaL_getmetatable(L, type);
+ assert(!lua_isnil(L, -1)); /* Failure here means that the usertype is unknown to ToLua. Check what type you're pushing. */
lua_pushstring(L,"tolua_ubox");
lua_rawget(L,-2); /* stack: mt ubox */
- if (lua_isnil(L, -1)) {
- lua_pop(L, 1);
- lua_pushstring(L, "tolua_ubox");
- lua_rawget(L, LUA_REGISTRYINDEX);
+ if (lua_isnil(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_pushstring(L, "tolua_ubox");
+ lua_rawget(L, LUA_REGISTRYINDEX);
};
lua_pushlightuserdata(L,value);
lua_rawget(L,-2); /* stack: mt ubox ubox[u] */