首页 \ 问答 \ Lua脚本和redis - 如何测试None值(Lua script and redis - how to test for None value)

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
更新时间:2022-01-11 08:01

最满意答案

您无法放大饼图。 我也没有看到任何需要。 您可能需要做的唯一情况是,如果饼图的大小被误设并且它大于图表的图表。 即使有可能它会调整大小,而不是缩放,因为所有数据都是不断可见的。


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 ...
  • 处理此问题的一种方法可能是选择此处演示的项目: 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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。