找回密码
 点一下
查看: 2270|回复: 9

local code variable = value

[复制链接]
发表于 2006-6-3 00:19:41 | 显示全部楼层 |阅读模式
[jass]function abc takes nothing returns nothing
endfunction

function functioncreate takes nothing returns nothing
local code s = (function abc)
endfunction[/jass]

汗饿,突然想看看怎么给函数设置局部变量
 楼主| 发表于 2006-6-3 00:25:43 | 显示全部楼层
但是无法用call s()去调用它……
call abc()到是可以
回复

使用道具 举报

发表于 2006-6-3 01:33:45 | 显示全部楼层
code
应该不是指一个函数。
呃。可能某种可执行代码。
就像触发事件的动作那样的。
呃。还有。就是单位组做的动作。
嗯。我理解为一个执行过程。嗯嗯。
回复

使用道具 举报

发表于 2006-6-3 12:14:02 | 显示全部楼层
原地址:http://jass.sourceforge.net/doc/types.shtml
code - A function may have parameters that are of type code. This means it must take a function reference as an argument. This is similar to a function pointer in C or C++. A function is referenced with the expression function func_name. For example, a function with the prototype:

function RunFunctionForAllPlayers takes code theFunction returns nothing

Would be called like this RunFunctionForAllPlayers(function someFunction).

A code value can also be null, which means it refers to no function (and should not be used in any native function).
回复

使用道具 举报

 楼主| 发表于 2006-6-3 12:27:46 | 显示全部楼层
纯粹好奇……在函数前面+上个function就可以将该函数转为code...理论上是这样的。
function functioncreate takes nothing returns nothing
local code s = (function abc)
endfunction
我估计只能这么调用
StartTimer(true,12,s)
回复

使用道具 举报

发表于 2006-6-3 18:31:52 | 显示全部楼层
原帖由 蚊子叮 于 2006-6-3 12:27 发表
纯粹好奇……在函数前面+上个function就可以将该函数转为code...理论上是这样的。
function functioncreate takes nothing returns nothing
local code s = (function abc)
endfunction
我估计只能这么调用
...

嗯。应该是的。
而且。可能还有个执行代码的那个函数。呃。名字记不得了。
回复

使用道具 举报

发表于 2006-6-3 19:31:45 | 显示全部楼层
function abc 应该只是返回该函数的地址或是编号之类的DD

用return bug就能看到每次执行返回的都是一样的值

[ 本帖最后由 Red_Wolf 于 2006-6-3 19:33 编辑 ]
回复

使用道具 举报

发表于 2006-8-24 15:25:07 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-8-24 22:15:08 | 显示全部楼层
理论上来说。在地图运行中是不会变的。
但是根据不同的地图之类的。在载入的时候应该会有变化。
回复

使用道具 举报

发表于 2006-8-25 11:05:13 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-2 08:53 , Processed in 0.098394 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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