Difference between revisions of "function (日本語)"
(Created page with "[http://www.lua.org/manual/5.1/manual.html#2.5.8 Lua における関数]。 <source lang="lua"> function foo() end </source> Category:Data TypesCategory:Lua == その...") |
m |
||
Line 2: | Line 2: | ||
<source lang="lua"> | <source lang="lua"> | ||
function foo() | function foo() | ||
+ | ~ | ||
end | end | ||
</source> | </source> | ||
+ | |||
+ | |||
+ | == ドット記法 (require 用) == | ||
+ | * utility.lua | ||
+ | <source lang="lua"> | ||
+ | utility = {} | ||
+ | |||
+ | |||
+ | function utility.options() | ||
+ | ~ | ||
+ | end | ||
+ | |||
+ | function utility.assist() | ||
+ | ~ | ||
+ | end | ||
+ | |||
+ | return utility | ||
+ | <source> | ||
+ | |||
+ | |||
+ | * main.lua | ||
+ | <source lang="lua"> | ||
+ | util = require ('utility') | ||
+ | |||
+ | gamestate = 1 | ||
+ | |||
+ | function love.draw() | ||
+ | if gamestate = 1 | ||
+ | util.options() | ||
+ | else | ||
+ | util.assist() | ||
+ | end | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | |||
[[Category:Data Types]][[Category:Lua]] | [[Category:Data Types]][[Category:Lua]] | ||
== そのほかの言語 == | == そのほかの言語 == | ||
{{i18n|function}} | {{i18n|function}} |
Revision as of 15:27, 20 October 2017
function foo()
~
end
ドット記法 (require 用)
- utility.lua
utility = {}
function utility.options()
~
end
function utility.assist()
~
end
return utility
<source>
* main.lua
<source lang="lua">
util = require ('utility')
gamestate = 1
function love.draw()
if gamestate = 1
util.options()
else
util.assist()
end
そのほかの言語
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info