enigma-devel
[Top][All Lists]
Advanced

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

Re: [Enigma-devel] Enigma editor, again


From: Karen Pouelle
Subject: Re: [Enigma-devel] Enigma editor, again
Date: Thu, 21 Jul 2005 18:40:30 +0000

> Lua scripts are only parsable by the Lua interpreter, so every level
> editor in existence has problems loading levels that aren't restricted
> to the most basic syntactic constructs.  Just as importantly, even *if*
> you include the Lua interpreter, you cannot restore the Lua file after
> loading it, mostly because it's not possible to recover the source code
> of functions after they have been loaded.
> 
> The lua2xml script currently chokes on all levels that use Lua functions
> as signal targets, for exactly that reason.  It *might* be possible to
> convert some of these levels by manually parsing them, copying all
> variable assignments and function definitions verbatim to the <lua>
> section, emitting a warning that the level may not work correctly and
> hoping for the best :-)  I'm only glad you cannot use anonymous
> functions as signal targets in Enigma ;-)
> 
> Daniel

I have not been able to get this to work in an XML level:

  <lua>
TIMERINT = 3.0
function trig_a()
  set_stone("st-stone1", 2, 13);
  set_stone("st-stone1", 1, 14);
  set_stone("st-stone1", 2, 14);
  motion_a = 1
end

function clock_a()
  if motion_a == 0 then
    set_stone("st-grate1", 2, 13);
    set_stone("st-grate1", 1, 14);
    set_stone("st-grate1", 2, 14);
  end
  motion_a = 0
end

set_item("it-trigger",  7, 3, {action="callback", target="trig_a"})
set_item("it-trigger", 11, 3, {action="callback", target="trig_a"})
set_item("it-trigger",  7, 9, {action="callback", target="trig_a"})
set_item("it-trigger", 11, 9, {action="callback", target="trig_a"})

set_stone("st-timer", 0, 0, {action="callback", target="clock_a",
interval=TIMERINT} )

motion_a = 0

  </lua>
</level>    
 
Is this the problem you're refering to?  Should I instead convert the non-LUA
section into LUA script and build the level in an 100% LUA script instead?

Karen




reply via email to

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