github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/vm/cvm/cmd/cvm_test.lua (about)

     1  local a = 1;
     2  b = 2;
     3  if a > b then
     4      print("-------------")
     5  else
     6      print("=============")
     7  end
     8  function max()
     9      print("max func be called")
    10      return 6
    11  end
    12  
    13  
    14  local _M = {}
    15  _M._VERSION = '1.0'
    16  
    17  local mt = {__index = _M}
    18  
    19  
    20  
    21  function init()
    22      local a = 1;
    23      local b = 2;
    24      max()
    25      if a > b then
    26          print("-------------")
    27      else
    28          print("=============")
    29      end
    30      mytable = {}
    31      mytable["key"] = "key"
    32      mytable[2] = 6
    33  --    store("a",a)
    34      store("mt",mt)
    35      store("mytalbe",mytable)
    36  end
    37  
    38  function _M.Withdraw( from, to, value )
    39      print(string.format("Withdraw from %s to %s, the amount is %d", from, to, value))
    40  end
    41  
    42  function _M.Transfer( from, to, value )
    43      print(string.format("Account %s initiates a transfer to account %s, the amount is %d", from, to, value))
    44  end
    45  
    46  function _M.Approval( from, to, amount )
    47      print(string.format("Account %s approves another account %s to allow it to be used for %d", from, to, amount))
    48  end
    49  init()
    50  return _M
    51