diff options
author | Mattes D <github@xoft.cz> | 2017-06-26 08:56:55 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-06-26 10:52:59 +0200 |
commit | e05ca494593d780c0ecf358bf66a94b224b35b5b (patch) | |
tree | c94b004d4c89aa118f889a2ae988cd354f69ace1 /src/Bindings/LuaState.h | |
parent | Fixed memory leak in cClientHandle. (#3794) (diff) | |
download | cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar.gz cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar.bz2 cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar.lz cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar.xz cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.tar.zst cuberite-e05ca494593d780c0ecf358bf66a94b224b35b5b.zip |
Diffstat (limited to 'src/Bindings/LuaState.h')
-rw-r--r-- | src/Bindings/LuaState.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 674c7a240..d8f39b09e 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -792,6 +792,10 @@ public: Returns false and logs a special warning ("wrong calling convention") if not. */ bool CheckParamSelf(const char * a_SelfClassName); + /** Returns true if the first parameter is the expected class (static). + Returns false and logs a special warning ("wrong calling convention") if not. */ + bool CheckParamStaticSelf(const char * a_SelfClassName); + bool IsParamUserType(int a_Param, AString a_UserType); bool IsParamNumber(int a_Param); @@ -808,6 +812,11 @@ public: /** Logs all items in the current stack trace to the server console */ static void LogStackTrace(lua_State * a_LuaState, int a_StartingDepth = 0); + /** Formats and prints the message, prefixed with the current function name, then logs the stack contents and raises a Lua error. + To be used for bindings when they detect bad parameters. + Doesn't return, but a dummy return type is provided so that Lua API functions may do "return ApiParamError(...)". */ + int ApiParamError(const char * a_MsgFormat, ...); + /** Returns the type of the item on the specified position in the stack */ AString GetTypeText(int a_StackPos); |