doc fixed, path function

This commit is contained in:
p.kosyh 2010-07-01 16:42:27 +00:00
parent 226d1bb4f1
commit 617d84536a
3 changed files with 40 additions and 4 deletions

View file

@ -32,7 +32,7 @@ At the beginning of “main.lua” file a header may be defined. It consists of
From version 1.2.0 after headers you must define required STEAD API version. It is "1.2.0" currently.
<code>
version "1.2.0"
instead_version "1.2.0"
</code>
Game initialization should be defined as init function. For example:
@ -908,7 +908,7 @@ Starting from version 1.2.0 you can use modules via “require” function call.
Modules can be used like this:
<code>
--$Name: My game!$
version "1.2.0"
instead_version "1.2.0"
require "para"
require "dbg"
...
@ -976,6 +976,17 @@ main = room {
}
}
</code>
You may use xroom:
<code>
main = xroom {
forcedsc = true;
dsc = [[ I'm in the room. ]];
xdsc = [[ I see an {anapple:apple} and a {aknife:knife}. ]];
obj = {
'apple', 'knife', 'chain', 'tool',
}
}
</code>
“input” module allows to implement simple text entry fields. “click” module helps to handle mouse clicks on scene pictures.

View file

@ -32,7 +32,7 @@
Начиная с версии 1.2.0 сразу после заголовков вам необходимо указать версию STEAD API, которая требуется игре. На данный момент последняя версия 1.2.0.
<code>
version "1.2.0"
instead_version "1.2.0"
</code>
Если version отсутствует, то STEAD API будет работать в режиме совместимости (устаревшее API).
@ -905,7 +905,7 @@ is_music() позволяет узнать, проигрывается ли му
Использование модуля выглядит так:
<code>
--$Name: Моя игра!$
version "1.2.0"
instead_version "1.2.0"
require "para"
require "dbg"
...
@ -973,6 +973,17 @@ main = room {
}
}
</code>
Вы можете также использовать комнату xroom:
<code>
main = xroom {
forcedsc = true;
dsc = [[Я в комнате.]];
xdsc = [[ Я вижу {apple:яблоко} и {knife:нож}. ]];
obj = {
'apple', 'knife', 'chain', 'tool',
}
}
</code>
Модуль input позволяет реализовывать простые поля ввода, а click отслеживает щелчки по картинке сцены.

View file

@ -173,5 +173,19 @@ function list_concat(self, other, pos)
end
end
function path(w, wh)
if not wh then
wh = here();
else
wh = ref(wh);
end
local o = ways(wh):srch(w);
o = ref(o);
if isRoom(o) then
return o
end
return nil
end
game.lifes = list(game.lifes)
stead:init(); -- reinit