lua中用table实现队列
来源:互联网 发布:人物动作设计软件 编辑:程序博客网 时间:2024/05/18 00:37
List = {}function List.new () return {first = 0, last = -1}endfunction List.pushleft (list, value) local first = list.first - 1 list.first = first list[first] = valueendfunction List.pushright (list, value) local last = list.last + 1 list.last = last list[last] = valueendfunction List.popleft (list) local first = list.first if first > list.last then error("list is empty") end local value = list[first] list[first] = nil -- to allow garbage collection list.first = first + 1 return valueendfunction List.popright (list) local last = list.last if list.first > last then error("list is empty") end local value = list[last] list[last] = nil -- to allow garbage collection list.last = last - 1 return valueend
2 0
- lua中用table实现队列
- 自己实现lua table
- lua实现的队列
- 关于lua table的实现
- 关于lua table的实现
- lua 队列的简单实现
- 实现Lua的双向队列
- Lua实现的栈、队列
- Lua 双向队列的实现
- Java中用LinkedList实现栈和队列
- 面试宝典中用C++实现循环队列
- Lua用闭包实现的table迭代器
- lua的table实现以及遍历方式
- Lua中table类型的源码实现
- Lua 语言输出Table详细信息的实现
- lua Table的插入简单实现
- Lua中table类型的源码实现
- lua数据结构之table的内部实现
- 如何在Java中使用注释
- 对象死亡的过程
- 现今主流的编程语言的来历
- iOS PCH
- 过采样和欠采样
- lua中用table实现队列
- 深度学习框架Tensorflow分布式实战多机多卡GPU,CPU并行
- PAT乙级1020
- POJ 1330 Nearest Common Ancestors(Tarjan)
- Filter、FilterChain
- PC^2使用指南
- Hessian的使用介绍
- c中关于位操作的一些运算
- JVM系列之Trace跟踪GC(一)