lua-users home
lua-l archive

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

I am in need to translate valid simple chunks of Lua
mostly if statements and for-loops

into valid PHP and Javascript code snippets

for example 

if tbA[id4]<tbB[id87]  then 

then java script would be (just pseudocode)

if (getDom("tbA.id4").getValue()<getDom("tbB.id87").getValue())

I understand that the most straighforward approach
(but not necessarely the simplest and easy to implement)
is to write my own parser (i am using Lpeg for my other things)

However, I would like to know if there is a way for me to
use Lua's load string,
then get access to byte-compiled code  and then translate the
code into whatever I need

Wouldn't this be simpler for me to do (as then Lua takes care of lexing,
parsing, etc)

Are there any examples of this (or even the first approach)?
May be there are other suggestions?

thank you in advance

  V S P

-- - A no graphics, no pop-ups email service