luaplus 与官方文档慢慢扯(二)
堆栈操作相关函数
GetTop()- Mirrorslua_gettop().SetTop(int index)- Mirrorslua_settop().PushValue(int index)- Mirrorslua_pushvalue().PushValue(LuaStackObject& object)- Mirrorslua_pushvalue().Remove(int index)- Mirrorslua_remove().Insert(int index)- Mirrorslua_insert().Replace(int index)- Mirrorslua_remove().CheckStack(int size)- Mirrorslua_checkstack().XMove(LuaState* to, int n)- Mirrorslua_xmove().Equal(int index1, int index2)- Mirrorslua_equal().RawEqual(int index1, int index2)- Mirrorslua_rawequal().LessThan(int index1, int index2)- Mirrorslua_lessthan().
值压入堆栈
PushNil()- Mirrorslua_pushnil().PushInteger(int n)- Mirrorslua_pushinteger().PushNumber(lua_Number n)- Mirrorslua_pushnumber().PushLString(const char* s, size_t len)- Mirrorslua_pushlstring().PushLWString(const lua_WChar* s, size_t len)- Mirrorslua_pushlwstring().PushString(const char* s)- Mirrorslua_pushstring().PushWString(const lua_WChar* s)- Mirrorslua_pushwstring().PushBoolean(bool value)- Mirrorslua_pushboolean().PushLightUserData(void* p)- Mirrorslua_pushlightuserdata().
把函数压入堆栈
PushCClosure(lua_CFunction fn, int n)- Mirrorslua_pushcclosure().PushCClosure(function, n)- function 有一个参数LuaState* 可以压入全局函数 静态函数 以及 成员函数.神奇!PushCFunction(lua_CFunction fn)- 同 lua_pushcfunction
检查参数
TypeError(narg, tname)- MirrorsluaL_typerror().ArgError(narg, extramsg)- MirrorsluaL_argerror().CheckLString(numArg, len)- MirrorsluaL_checklstring().OptLString(numArg, def, len)- MirrorsluaL_optlstring().CheckNumber(numArg)- MirrorsluaL_checknumber().OptNumber(nArg, def)- MirrorsluaL_optnumber().ArgCheck(condition, numarg, extramsg)- MirrorsluaL_argcheck().CheckString(numArg)- MirrorsluaL_checkstring().OptString(numArg, def)- MirrorsluaL_optstring().CheckInt(numArg)- MirrorsluaL_checkint().CheckLong(numArg)- MirrorsluaL_checklong().OptInt(numArg, def)- MirrorsluaL_optint().OptLong(numArg, def)- MirrorsluaL_optlong().CheckStack(int sz, const char* msg)- MirrorsluaL_checkstack().CheckType(narg, t)- MirrorsluaL_checktype().CheckAny(int narg)- MirrorsluaL_checkany().CheckUData(int ud, const char* tname)- MirrorsluaL_checkudata().
操作堆栈table相关函数 (It is highly recommended LuaObject is used instead, as it provides a much better C++ alternative than the Lua stack.) –>强烈建议使用 LuaObject来操作 因为它提供了比lua堆栈函数更好的替代方法
SetTable(int index)- Mirrorslua_settable().RawSet(int index)- Mirrorslua_rawset().RawSetI(int index, int n)- Mirrorslua_rawseti().SetMetaTable(int index)- Mirrorslua_setmetatable().SetGlobals(int index)- Mirrorslua_setfenv(). Backward compatible.SetFEnv(int index)- Mirrorslua_setfenv().SetGlobal(const char *name)- Mirrorslua_setglobal().Ref(int lock)- MirrorsluaL_ref().Unref(int ref)- MirrorsluaL_unref().SetDefaultMetaTable(int type)- Sets the default meta table for the given type with the table at the stack top.- –这个函数暂时不懂
感谢您的阅读,本文由 smallwhite's Blog 版权所有。如若转载,请注明出处:smallwhite's Blog(https://smallwhite.ml/pub/uncategorized/luaplus-yu-guan-fang-wen-dang-man-man-che-er.html)