Lua编程遇到的错误1
来源:互联网 发布:博微设计软件 编辑:程序博客网 时间:2024/06/04 18:58
Lua入门错误
--example1@luaw= Windows{ x=0, y=0, width=300, height=200, title = "lua",background="blue", border= true}function Windows( options ) if type(options.title) ~="string" then error("no title") elseif type(options.width)~= "number" then error("no width") elseif type(options.height)~="number" then error("no height") else print("输入无错") endend
运行后,cmd提示attempt to call golbal 'Windows'(a nil value)
隐约觉得是不是和函数定义有关,函数定义先于使用
换为如下代码,程序正常运行
--example1function Windows( options ) if type(options.title) ~="string" then error("no title") elseif type(options.width)~= "number" then error("no width") elseif type(options.height)~="number" then error("no height") else print("输入无错") endendw= Windows{ x=0, y=0, width=300, height=200, title = "lua",background="blue", border= true}
但是,定义也未必先于使用
定义一个不带参数的函数,是可以不用放在调用该函数语气的前面的,带参数就不行了
阅读全文
0 0
- Lua编程遇到的错误1
- lua遇到的错误
- 编程中遇到的错误
- Lua编程中遇到的table类型传递引用问题
- 网络编程遇到的一个Link错误
- 编程过程中遇到的错误
- 编程中遇到过的错误记录
- C/C++编程中遇到的错误
- Hibernate编程中遇到的错误
- KEIL编程时遇到的常见错误
- Java EE编程中遇到的错误
- cuda编程遇到的. 错误记录
- 本人编程遇到的一些错误解决办法
- 编程过程中遇到的错误
- c++编程中遇到的错误定位
- 总结:Javaweb网络编程遇到的错误
- 编程遇到错误的排查方法
- android遇到的错误1
- C和指针之字符串strchr、strpbrk、strstr
- hdoj 1719 Friend(公式)
- HDU 4501 小明系列故事——买年货(三维背包)
- VideoView
- MySQL慢查询优化之Limit优化
- Lua编程遇到的错误1
- java的循环,数组,以及方法
- ASP.NET Web Pages
- ActiveMQ发布消息和订阅消息
- 基础练习 回文数
- 数据库的设计
- 2.3工作区和暂存区
- 常用类
- 实验二:双链表