[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Emulating .prototype semantics of JavaScript in Lua. What does it take?
- From: "Vijay Aswadhati" <wyseman@...>
- Date: Tue, 17 Feb 2004 09:26:18 -0800
Greetings:
Back from a two month long sabbatical - offered as an excuse for me not
thinking too hard on the subject!
I have dabbled with metatables and I think I have basic yet fuzzy
understanding of how it all works. In one of the projects that I will be
working on, I have already made my decision to incorporate Lua as the
scripting language of choice for backend systems. However the browser-based
front end systems are chockfull of JavaScripts unavoidably. To aid the poor
programmer who will be working on both backend and front-end systems, I am
contemplating on hiding all the details of metatables of Lua and present
instead something similar to JavaScript "prototype" based inheritance in
terms of look and feel. My gut feeling says that it should be doable and it
stands at that. Now for the questions:
a) Can I emulate this using the Lua API itself or will I have to modify the
source code?
b) If doable either way, any gotchas about performance - pay as you go
versus pay upfront?
c) Any other issues that I need to be aware of.
My intention is not start a debate on changing Lua to be something else - I
understand and appreciate the differences in opinion. For the curious there
is a very simple tutorial illustrating the use of ".prototype" at
http://www.javascriptkit.com/javatutors/proto.shtml
Thanks for your time.
Vijay Aswadhati