Add support for doc(builtin)
This commit is contained in:
@@ -478,7 +478,7 @@ private:
|
||||
static LuaFunctionReg *LuaFunctionRegistry;
|
||||
|
||||
public:
|
||||
using List = std::vector<const LuaFunctionReg *>;
|
||||
using List = std::vector<LuaFunctionReg *>;
|
||||
|
||||
LuaFunctionReg(const char *name, const char *args, const char *docs, lua_CFunction f);
|
||||
static List all();
|
||||
@@ -488,6 +488,7 @@ public:
|
||||
const char *get_args() const { return args_; }
|
||||
const char *get_docs() const { return docs_; }
|
||||
lua_CFunction get_func() const { return func_; }
|
||||
void set_func(lua_CFunction fn) { func_ = fn; }
|
||||
};
|
||||
|
||||
|
||||
@@ -497,6 +498,10 @@ public:
|
||||
int lfn_##name(lua_State *L)
|
||||
|
||||
|
||||
#define LuaDefineBuiltin(name, args, docs) \
|
||||
LuaFunctionReg reg_##name(#name, args, docs, nullptr);
|
||||
|
||||
|
||||
#define LuaStringify(x) #x
|
||||
#define LuaAssert(L, x) if (!(x)) { luaL_error((L), "Assert failed: %s (file %s line %d)", LuaStringify(x), __FILE__, __LINE__); }
|
||||
#define LuaAssertStrEq(L, x, y) { std::string _s1_ = (x); std::string _s2_ = (y); if (_s1_ != _s2_) luaL_error((L), "Assert failed: value=%s (file %s line %d)", _s1_.c_str(), __FILE__, __LINE__); }
|
||||
|
||||
Reference in New Issue
Block a user