enigma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Enigma-devel] Lua API


From: Andreas Lochmann
Subject: Re: [Enigma-devel] Lua API
Date: Fri, 19 Oct 2007 15:45:38 +0200
User-agent: IceDove 1.5.0.12 (X11/20070607)

Hi all,

well, everybody should have read and thought about the new API till now,
so, let's start feedback. :-)


[C1 - Object Based Syntax]

When I use
 x, y = GetXY(myactor)
what do I get? The integer or float coordinates of the actor?

Consecutive naming of objects (building object groups)

  wo[pos] = {"st_chess", color = 0, name="Atrax#"}

For each call of the line above the new object will be named with a unique number appended after the "#" giving "Atrax#1", "Atrax#2", "Atrax#3", ...
What happens if I set "Atrax#2" directly and then create "Atrax#"?

And, if I create "Atrax#1" and "Atrax#2", then delete "Atrax#1" and
create "Atrax#" again, which will be the new name?

Can I access a group like a lua-table, like in:
 for j, v in pairs(no["Atrax#"]) do
   ...
 end

Killing an object:

  obj:kill()
  wo[pos] = {"it_nil"}
Is killing a floor tile possible?

Messages:

  my_bolder:message("direction", WEST)
Would it be
 my_trigger:message("callback", myfunction)
or
 my_trigger:message("callback", "myfunction") ?

Classification of objects:
. obj:is("st_chess")
. obj:is("st")
. obj:is("st_chess_black")
How does this work? Is it pattern matching, such that
 my_chess:is("st_ch")
 my_chess:is("*_black")
are true as well?


[C4 - Multitarget and Multiaction ]
Different targets can take different actions:

my_switch = {"st_switch", target={my_door, my_laser, "my_function"},
    action={"open_close", "on_off", "callback"}}
Is the following possible:
 my_switch = {"st_switch", target={no["door#"], no["laser#"]},
   action = {"open_close", "on_off"}}

Is it neccessary to switch from "openclose" to "open_close" etc?


Every callback takes the arguments (state_value, sender) where
"state_value" is an integer value that represents the internal state
of the sender object. For switch like objects the state will be 0 for
"off" and 1 for "on". Other objects like fourswitch etc. will count the
their states from 0, 1, 2,...
Is it possible to combine this with Booleans, or will there
be global constants like STATE_OFF, STATE_ON, STATE_WEST etc.?

Will there be a correspondence between the fourswitch-state and
the directions-constants?

Is it possible to access this internal state directly?


[C5 - Renaming]

- Short 2 or 3 letter names for the namespace and the special objects
- System attribute and message names have to be valid Lua names not
  starting with underscore
- User attributes start with an underscore
- System attribute and method names are disjoint
What happens when I use a user attribute without underscore, or
a system attribute of a newer Enigma version with an older version?

- Object Classnames should use a common scheme of underscore/hyphen
  usage: Either underscore only, or first hyphen and all other
  underscore,... (st_chess_black, st-chess_black, ...)
This might be the most difficult point, though neccessary.


[C11 - Checkerboard Floor   (coded) ]

Every floor takes an attribute "checkerboard". If set to interger value
0 the floor will only be placed on grids with x+y being even, if set
to 1 the floor will be placed only on grids with x+y being uneven.

ti["x"] = ti({"fl_rough_red", checkerboard=0}) +
         {"fl_rough_blue", checkerboard=1}

generates an arbitrary shaped checkboardfloor on areas with tile "x"
on the world map.
Is it possible to add further algorithms in future?
C.f. the algorithms used in libsoko.


Greets,
Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]