當前位置: 首頁>>代碼示例>>C++>>正文


C++ GLua_CheckBitStream函數代碼示例

本文整理匯總了C++中GLua_CheckBitStream函數的典型用法代碼示例。如果您正苦於以下問題:C++ GLua_CheckBitStream函數的具體用法?C++ GLua_CheckBitStream怎麽用?C++ GLua_CheckBitStream使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GLua_CheckBitStream函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GLua_BitStream_Index

static int GLua_BitStream_Index(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	const char *key = lua_tostring(L,2);
	GLUA_UNUSED(stream);
	lua_getmetatable(L,1);
	lua_getfield(L,-1,key);
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:8,代碼來源:glua_bitstream.cpp

示例2: GLua_BitStream_ToString

static int GLua_BitStream_ToString(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	if (stream->reading) {
		lua_pushstring(L,va("BitStream [ Reading - %i / %i bytes ]", stream->stream.readcount, stream->stream.maxsize ));
	} else {
		lua_pushstring(L,va("BitStream [ Writing - %i / %i bytes ]", stream->stream.cursize, stream->stream.maxsize ));
	}
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:9,代碼來源:glua_bitstream.cpp

示例3: GLua_BitStream_GetData

static int GLua_BitStream_GetData(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	
	if (stream->reading) {
		lua_pushlstring(L, stream->data, stream->stream.maxsize);
	} else {
		lua_pushlstring(L, stream->data, stream->stream.cursize);
	}
	return 1;
}
開發者ID:Stoiss,項目名稱:JediKnightGalaxies,代碼行數:10,代碼來源:glua_bitstream.c

示例4: GLua_BitStream_Reset

static int GLua_BitStream_Reset(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	if (stream->reading) {
		BitStream_BeginReading(&stream->stream);
	} else {
		stream->stream.cursize = 0;
		stream->stream.bit = 0;
	}
	return 0;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:10,代碼來源:glua_bitstream.cpp

示例5: GLua_BitStream_GetLength

static int GLua_BitStream_GetLength(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	
	if (stream->reading) {
		lua_pushinteger(L, stream->stream.maxsize);
	} else {
		lua_pushinteger(L, stream->stream.cursize);
	}
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:10,代碼來源:glua_bitstream.cpp

示例6: GLua_BitStream_BytesRemaining

static int GLua_BitStream_BytesRemaining(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	
	if (stream->reading) {
		lua_pushinteger(L, stream->stream.maxsize - stream->stream.readcount);
	} else {
		lua_pushinteger(L, stream->stream.maxsize - stream->stream.cursize);
	}
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:10,代碼來源:glua_bitstream.cpp

示例7: GLua_BitStream_GetData

static int GLua_BitStream_GetData(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	
	if (stream->reading) {
		lua_pushlstring(L, reinterpret_cast<const char *>(stream->data), stream->stream.maxsize);
	} else {
		lua_pushlstring(L, reinterpret_cast<const char *>(stream->data), stream->stream.cursize);
	}
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:10,代碼來源:glua_bitstream.cpp

示例8: GLua_BitStream_WriteUInt

static int GLua_BitStream_WriteUInt(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	unsigned int val = luaL_checkinteger(L,2);
	
	if (stream->reading) {
		luaL_error(L, "Attempted to write to a read-only bitstream");
		return 0;
	}

	BitStream_WriteUInt(&stream->stream, val);
	
	return 0;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:13,代碼來源:glua_bitstream.cpp

示例9: GLua_BitStream_WriteBool

static int GLua_BitStream_WriteBool(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	int val = lua_toboolean(L,2);
	
	if (stream->reading) {
		luaL_error(L, "Attempted to write to a read-only bitstream");
		return 0;
	}

	BitStream_WriteBool(&stream->stream, val);
	
	return 0;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:13,代碼來源:glua_bitstream.cpp

示例10: GLua_BitStream_WriteString

static int GLua_BitStream_WriteString(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	const char *val = luaL_checkstring(L,2);
	
	if (stream->reading) {
		luaL_error(L, "Attempted to write to a read-only bitstream");
		return 0;
	}

	BitStream_WriteString(&stream->stream, val);
	
	return 0;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:13,代碼來源:glua_bitstream.cpp

示例11: GLua_BitStream_WriteDouble

static int GLua_BitStream_WriteDouble(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	double val = luaL_checknumber(L,2);
	
	if (stream->reading) {
		luaL_error(L, "Attempted to write to a read-only bitstream");
		return 0;
	}

	BitStream_WriteDouble(&stream->stream, val);
	
	return 0;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:13,代碼來源:glua_bitstream.cpp

示例12: GLua_BitStream_ReadDouble

static int GLua_BitStream_ReadDouble(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	double val;
	
	if (!stream->reading) {
		luaL_error(L, "Attempted to read from a write-only bitstream");
		return 0;
	}

	val = BitStream_ReadDouble(&stream->stream);
	
	lua_pushnumber(L, val);
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:14,代碼來源:glua_bitstream.cpp

示例13: GLua_BitStream_ReadUInt

static int GLua_BitStream_ReadUInt(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	unsigned int val;
	
	if (!stream->reading) {
		luaL_error(L, "Attempted to read from a write-only bitstream");
		return 0;
	}

	val = BitStream_ReadUInt(&stream->stream);
	
	lua_pushinteger(L, val);
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:14,代碼來源:glua_bitstream.cpp

示例14: GLua_BitStream_ReadBool

static int GLua_BitStream_ReadBool(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	int val;
	
	if (!stream->reading) {
		luaL_error(L, "Attempted to read from a write-only bitstream");
		return 0;
	}

	val = BitStream_ReadBool(&stream->stream);
	
	lua_pushboolean(L, val);
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:14,代碼來源:glua_bitstream.cpp

示例15: GLua_BitStream_ReadString

static int GLua_BitStream_ReadString(lua_State *L) {
	GLua_Bitstream_t *stream = GLua_CheckBitStream(L, 1);
	luaL_Buffer B;
	char ch;
	
	if (!stream->reading) {
		luaL_error(L, "Attempted to read from a write-only bitstream");
		return 0;
	}

	luaL_buffinit(L, &B);
	while (1) {
		ch = BitStream_ReadChar(&stream->stream);
		if (!ch) {
			break;
		}
		luaL_addchar(&B, ch);
	}
	luaL_pushresult(&B);
	return 1;
}
開發者ID:NikitaRus,項目名稱:JediKnightGalaxies-1,代碼行數:21,代碼來源:glua_bitstream.cpp


注:本文中的GLua_CheckBitStream函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。