设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

draw_text引用换行符脚本出错

查看数: 1567 | 评论数: 3 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2017-6-17 21:36

正文摘要:

本帖最后由 RyanBern 于 2017-6-19 09:37 编辑 这个脚本是用来draw_text可以使用换行符的,但导入出错了 报错下面有图片 这是脚本 RUBY 代码复制class Bitmap  alias :draw_te ...

回复

RyanBern 发表于 2017-6-18 19:10:50
以下内容来自 rubydoc.org
纠正一下猫叔的说法,defined? 是关键字不是一个方法,所以说“参数”不太合适。改成“语法”[Synopsis]比较好。
defined?

defined? expression tests whether or not expression refers to anything recognizable (literal object, local variable that has been initialized, method name visible from the current scope, etc.). The return value is nil if the expression cannot be resolved. Otherwise, the return value provides information about the expression.

Note that the expression is not executed.

p defined?(def x; end)   # "expression"
x                        # error: undefined method or variable

p defined?(@x=1)         # "assignment"
p @x                     # nil

Assignment to a local variable will, however, have the usually result of initializing the variable to nil by virtue of the assignment expression itself:

p defined?(x=1)          # assignment
p x                      # nil

In most cases, the argument to defined? will be a single identifier:

def x; end
p defined?(x)            # "method"

评分

参与人数 1星屑 +66 收起 理由
guoxiaomi + 66 塞糖

查看全部评分

破碎记忆 发表于 2017-6-18 12:04:15
guoxiaomi 发表于 2017-6-18 06:12
会不会是,defined? 的参数是方法调用,而不是方法名(symbol对象),去掉defined?
后面的冒号看看 ...

嗯,确实是,大神啊。

点评

不过是百度一下 defined? 的用法  发表于 2017-6-18 12:18
guoxiaomi 发表于 2017-6-18 06:12:37
会不会是,defined? 的参数是方法调用,而不是方法名(symbol对象),去掉defined?
后面的冒号看看

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 6

查看全部评分

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-21 20:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表