Lua脚本和redis - 如何测试None值(Lua script and redis - how to test for None value)
以下是我的lua脚本:
local ckid = redis.pcall('get',KEYS[1]) local meta = redis.call('hgetall', ckid) return {ckid, meta}
如果密钥没有退出第一个电话,我不想执行第二个。
所以......我没有什么是没有回报的价值。 在python中,返回值是None。
if ckid ~= '???????' then local meta = redis.call('hgetall', ckid) else local meta = 'empty' retrun {ckid, meta}
所以...我怎么做这个是lua?
local ckid = redis.pcall('get',KEYS[1]) if ckid ~= nil then local meta = redis.call('hgetall', ckid) else local meta = 'none' local ckid = 'none' end return {ckid, meta}
当使用零..
ResponseError: ERR Error running script (call to f_1400713412b0063a26eb0dc063f53a4e3be26380): user_script:12: Script attempted to access unexisting global variable 'meta'
Below is my lua script:
local ckid = redis.pcall('get',KEYS[1]) local meta = redis.call('hgetall', ckid) return {ckid, meta}
if the key does not exits for the first call I would not like to execute the second.
So...I don't what the return value is for None. In python the return value would be None.
if ckid ~= '???????' then local meta = redis.call('hgetall', ckid) else local meta = 'empty' retrun {ckid, meta}
So...how do I do this is lua?
local ckid = redis.pcall('get',KEYS[1]) if ckid ~= nil then local meta = redis.call('hgetall', ckid) else local meta = 'none' local ckid = 'none' end return {ckid, meta}
When using nil..
ResponseError: ERR Error running script (call to f_1400713412b0063a26eb0dc063f53a4e3be26380): user_script:12: Script attempted to access unexisting global variable 'meta'
原文:https://stackoverflow.com/questions/13206613
最满意答案
您无法放大饼图。 我也没有看到任何需要。 您可能需要做的唯一情况是,如果饼图的大小被误设并且它大于图表的图表。 即使有可能它会调整大小,而不是缩放,因为所有数据都是不断可见的。
You can’t zoom in on a pie chart. Nor do I see any need to. The only case you might need to do that is if the size of the pie is misset and it is bigger than the chart’s plot. Even if there was some possibility it would be resizing, and not zooming, since all the data is visible constantly.
相关问答
更多-
你似乎需要什么是不可能的。 首先,因为每个容器可能只有一个图表。 就Shield UI Charting库允许的内容而言。 您可能会发现更有用的是尝试极坐标系列,其中数据显示在中心点周围。 此外,圆环图没有半径属性。 您可以根据图表的宽度和高度调整尺寸,以便在需要时实现任何特殊效果。 What you seem to be in need is not possible. First of all because you may only have one chart per container. Spea ...
-
我认为这只是你做出的一个合成错误。 您需要设置所需的持续时间,而不是添加true。 这是有效的代码: applyAnimation: { duration: 1500 } I think that it is merely a synthax error that you have made. You need to set the desired duration, instead of adding true. Here is the code that works: applyAnimati ...
-
是。 在图表完全加载后会发生事件事件。 在处理远程数据时尤其重要,与图表本身的加载时间相比,这可能需要更多时间。 以下是使用load事件的示例: events: { load: function(event) { alert("Chart has finished Loading"); } } Yes. There is an event- events, that occurs after the chart has loaded completely. This is esp ...
-
categoricalValues属性用于显示每个类别的类别和相应的值。 虽然使用几个月看起来有点令人困惑。 然而,一旦在X轴上放置了一个类别,那么在使用类别列表之后再没有出现该类别的逻辑原因。 原因很简单 - 如果有A类,再次出现将不会产生任何意义,因为我们已经拥有它。 The categoricalValues property is used for showing categories and the corresponding values for each category. Although ...
-
没有用于启用滴答的明确值。 但是,由于您正在寻找可见效果,我可以建议以下代码: axisX:{ categoricalValues: ['2009','2010','2011'], ticksHeight: 11, ticksWidth: 0 }, 如您所见,您可以将刻度线宽度(或高度)设置为0,以使它们消失。 There is not an explicit value used for enabling the ticks. However since you are looking fo ...
-
事实上,有一个颜色属性,但它是一部分 legendItemSettings: {} 属性,可以称为CSS属性,而不是Shield UI Chart的属性。 所以你是对的,mapLegend没有颜色属性,但是我们可以通过使用来调整项目的颜色 elementStyle:{} 财产如下图所示: chartLegend: { legendItemSettings: { elementStyle: { color: 'red' } } } As ...
-
你是对的,Shield UI Chart没有addPoints方法。 但是,我们可以将传入的数据值添加到数组中。 您可能会发现以下有用的代码: 我们需要一些数组 - 我们需要显示的数量。 var EURUSD = new Array(); var USDCAD = new Array(); var GBPUSD = new Array(); 在函数体中,实际显示数据我们将得到以下代码: EURUSD[EURUSD.length] = parseFloat(data.tick ...
-
您无法放大饼图。 我也没有看到任何需要。 您可能需要做的唯一情况是,如果饼图的大小被误设并且它大于图表的图表。 即使有可能它会调整大小,而不是缩放,因为所有数据都是不断可见的。 You can’t zoom in on a pie chart. Nor do I see any need to. The only case you might need to do that is if the size of the pie is misset and it is bigger than the chart ...
-
以编程方式选择Shield UI饼图切片(通过Wicket)(Programmatically selecting a Shield UI Pie Chart slice (via Wicket))[2023-03-30]
处理此问题的一种方法可能是选择此处演示的项目: http : //www.shieldui.com/documentation/javascript.chart/api/dataSeries/data/selected One way to handle this may be to select the item as demonstrated here: http://www.shieldui.com/documentation/javascript.chart/api/dataSeries/data/ ... -
作为当前版本的Shield UI Chart,当然,根据图表类型,通过设置指定的属性不能隐藏X轴。 但是,通过将轴颜色设置为与绘图颜色相匹配,可以实现不可见性的效果。 或者在大多数情况下为白色。 As ot the current version Shield UI Chart, depending on the chart type, of course, the X axis cannot be hidden by setting a specified property. However the ef ...