예제 #1
0
v2s16 read_v2s16(lua_State *L, int index)
{
	v2s16 p;
	CHECK_POS_TAB(index);
	lua_getfield(L, index, "x");
	p.X = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "y");
	p.Y = lua_tonumber(L, -1);
	lua_pop(L, 1);
	return p;
}
예제 #2
0
v2f check_v2f(lua_State *L, int index)
{
	v2f p;
	CHECK_POS_TAB(index);
	lua_getfield(L, index, "x");
	CHECK_POS_COORD("x");
	p.X = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "y");
	CHECK_POS_COORD("y");
	p.Y = lua_tonumber(L, -1);
	lua_pop(L, 1);
	return p;
}
예제 #3
0
v3f read_v3f(lua_State *L, int index)
{
	v3f pos;
	CHECK_POS_TAB(index);
	lua_getfield(L, index, "x");
	pos.X = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "y");
	pos.Y = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "z");
	pos.Z = lua_tonumber(L, -1);
	lua_pop(L, 1);
	return pos;
}
예제 #4
0
v3f check_v3f(lua_State *L, int index)
{
	v3f pos;
	CHECK_POS_TAB(index);
	lua_getfield(L, index, "x");
	CHECK_POS_COORD("x");
	pos.X = lua_tonumber(L, -1);
	CHECK_FLOAT_RANGE(pos.X, "x")
	lua_pop(L, 1);
	lua_getfield(L, index, "y");
	CHECK_POS_COORD("y");
	pos.Y = lua_tonumber(L, -1);
	CHECK_FLOAT_RANGE(pos.Y, "y")
	lua_pop(L, 1);
	lua_getfield(L, index, "z");
	CHECK_POS_COORD("z");
	pos.Z = lua_tonumber(L, -1);
	CHECK_FLOAT_RANGE(pos.Z, "z")
	lua_pop(L, 1);
	return pos;
}
예제 #5
0
v3f check_v3f(lua_State *L, int index)
{
	v3f pos;
	CHECK_POS_TAB(index);
	lua_getfield(L, index, "x");
	CHECK_POS_COORD("x");
	pos.X = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "y");
	CHECK_POS_COORD("y");
	pos.Y = lua_tonumber(L, -1);
	lua_pop(L, 1);
	lua_getfield(L, index, "z");
	CHECK_POS_COORD("z");
	pos.Z = lua_tonumber(L, -1);
	lua_pop(L, 1);
	if(util_isnan(pos.X))
		throw LuaError("NaN passed as X coordinate");
	if(util_isnan(pos.Y))
		throw LuaError("NaN passed as Y coordinate");
	if(util_isnan(pos.Z))
		throw LuaError("NaN passed as Z coordinate");
	return pos;
}