Code Monkey home page Code Monkey logo

lua-alchemy's Introduction

Lua Alchemy is no longer supported

Dear Lua Alchemy users,

Thank you for your support in all these years! As you know, Lua Alchemy is based on the old Adobe Alchemy technology, which is no longer supported by Adobe.

If you need Lua support in the browser, take a look at lua.vm.js, lua5.1.js, Moonshine and other JS-based implementations. They are the future.

If you really need to use Lua in Adobe Flash, you may want to find someone to sponsor Lua Alchemy port to FlashCC, which is the current supported version of Adobe Alchemy. My company engineers are available to do the actual work, but, alas, I do not have resources to do this as an unpaid personal hobby project myself. If you're interested, please contact us at [email protected].

If you need commercial support for the current Lua Alchemy, write at the same address.

You can get free support from the community at the Lua Alchemy mailing list and on StackOverflow.

-- Alexander Gladysh, the Lua Alchemy maintainer.

Background

Lua is a great dynamic programming language, Adobe Flash is a great universal platform for applications and Adobe Alchemy is the tool to bind them together.

The main webpage can be found here: http://code.google.com/p/lua-alchemy/

Lua

Lua is a powerful, fast, light-weight, embeddable scripting language.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

-- http://lua.org/about.html

Adobe Flash

Adobe Flash (previously called "Macromedia Flash"') is a set of multimedia software created by Macromedia and currently developed and distributed by Adobe Systems. Since its introduction in 1996, Flash has become a popular method for adding animation and interactivity to web pages; Flash is commonly used to create animation, advertisements, and various web page components, to integrate video into web pages, and more recently, to develop rich Internet applications.

-- http://en.wikipedia.com/wiki/Flash

Adobe Alchemy

With Alchemy, Web application developers can now reuse hundreds of millions of lines of existing open source C and C++ client or server-side code on the Flash Platform. Alchemy brings the power of high performance C and C++ libraries to Web applications with minimal degradation on AVM2. The C/C++ code is compiled to ActionScript 3.0 as a SWF or SWC that runs on Adobe Flash Player 10 or Adobe AIR 1.5.

-- http://labs.adobe.com/technologies/alchemy/

Motivation

We need Lua Alchemy to...

  • ...To use run-time dynamic programming language (Lua) within the Flash framework.
  • ...To reuse existing Lua code for the Flash-based utilities
  • ...To get a great cross-platform back-end (Flash) for (simpler) Lua-based games
  • ...To have fun with awesome new technology :-)

File Manifest

AUTHORS - Contact information for the authors of lua-alchemy
BUGS - List of known issues
COPYRIGHT - Copyright for the lua-alchemy project
HISTORY - Project history log
README - This file describing the project
SPONSORS - The list if Lua Alchemy sponsors
alchemy/ - Builds lua-alchemy.swc
build/ - Build utility tools
demo/ - Flash and Flex demos
etc/ - Odds and ends of various usefulness
test/ - Lua and ActionScript tests

Bitdeli Badge

lua-alchemy's People

Contributors

agladysh avatar rstehwien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-alchemy's Issues

Strict compilation options

Original issue 30 created by lua-alchemy on 2008-12-20T20:39:25.000Z:

Lua Alchemy code must compile with at least these GCC flags:

-Werror -Wall -ansi -pedantic

Consider LUA_ENVIRONINDEX

Original issue 31 created by lua-alchemy on 2008-12-20T20:56:12.000Z:

Consider moving to LUA_ENVIRONINDEX from of LUA_REGISTRYINDEX for better
private data encapsulation. Consult Lua Programming Gems.

can I embed resource more fluency

I have two way to embed lua source to my project now.

  1. use [embed(source="mylua.lua")]
  2. use dynamic url loader.

But I want create my project mainly use lua, means a lot of lua files, and lua files distributed into release swf files.

The 2nd way can't make into package. the 1st way will write many useless code just for map lua files.

Are there any better way to embed many lua files?

Variadic luaDoString

Original issue 39 created by lua-alchemy on 2008-12-21T21:39:57.000Z:

This should be possible:

AS:

lua_wrapper.luaDoString(luaState, "...code...", arg1, arg2, ... argN)

Lua

local arg1, arg2, argN = ...

Fix or replace the code editor in demo/LuaAlchemyDemo

Original issue 3 created by lua-alchemy on 2008-12-19T05:33:34.000Z:

Copying from the code editor and pasting into the code editor or elsewhere
can result in line returns being lost. Seems to happen more often if you
paste code into the editor and then copy.

Also had to do a serious hack to get formatted code out of the TextArea
properly.

Consider using a JavaScript editor
http://en.wikipedia.org/wiki/Comparison_of_Javascript-based_source_code_editors

Despam flashlog

Original issue 13 created by lua-alchemy on 2008-12-19T22:51:44.000Z:

Especially see for that "Updated value" string

as3.toas3()

Original issue 38 created by lua-alchemy on 2008-12-21T21:25:13.000Z:

as3.trace("aaa")
local fn = as3.new("Function", function() as3.trace(" bbb") end)
as3.call(fn, "apply")

Above would not work as Function object is not configurable.

This is needed (looks like) to be able to call removeListener on events:

f = function() some code end
as3.call(button, "addEventListener", f)
as3.call(button, "removeEventListener, f)

Those two fs would not result in the same AS object. Two separate calls to
create_callback() here.

That might work as is, but if it doesn't we could make a as3.function()
that calls the callback code and returns the AS3_Function value

Error handling in callbacks

Original issue 4 created by lua-alchemy on 2008-12-19T05:45:33.000Z:

We should be able to handle the following:

as3.call(button, "addEventListener", "click",
function (e)
error("BWAHAHA")
end)

Throw an error?

Debug allocator

Original issue 23 created by lua-alchemy on 2008-12-20T13:37:57.000Z:

Alchemy does not segfault.

We need to employ some debug allocator so we would be covered from memory
errors. It must be on at least in the debug builds.

One candidate: http://dmalloc.com/

Refactor tests

Original issue 29 created by lua-alchemy on 2008-12-20T20:25:47.000Z:

Current tests boilerplate code is too huge. Too low signal-to-noise ratio.
Need to employ some wrappers

Rename as3.yield()

Original issue 43 created by lua-alchemy on 2008-12-22T21:29:02.000Z:

We must rename as3.yield() to avoid confusion with Lua coroutines.

Investigate tests crash with Lua built with -O3

Original issue 44 created by lua-alchemy on 2008-12-22T22:00:12.000Z:

(cd lua; make generic CFLAGS="-O3 -Wall -DLUA_USE_POSIX -DLUA_ANSI")

Now Setting Up testAS3Metatable
Now Running testAS3Metatable
Now Tearing Down testAS3Metatable
TestWraper::tearDown(): begin
begin
TestWrapper::tearDown(): error Error # 1506: Указан недопустимый диапазон.

All tests afterwards fail.

Lua-side tests must avoid returning values to AS

Original issue 28 created by lua-alchemy on 2008-12-20T20:24:20.000Z:

Example:

Instead of

public function testAS3Type():void
{
  var script:String = ( <![CDATA[
    ba = as3.new("flash.utils::ByteArray")
    s = as3.new("String")
    return as3.type(ba), as3.type(s)
    ]]> ).toString();
  var stack:Array = lua_wrapper.luaDoString(luaState, script);
  assertTrue(stack[0]);
  assertEquals("flash.utils::ByteArray", stack[1]);
  assertEquals("String", stack[2]);
  assertEquals(3, stack.length);
}

Should be

public function testAS3Type():void
{
  var script:String = ( <![CDATA[
    assert(as3.type(as3.new("flash.utils::ByteArray") ==

"flash.utils::ByteArray")
assert(as3.type(as3.new("String")) == "String")
]]> ).toString();
var stack:Array = lua_wrapper.luaDoString(luaState, script);
assertTrue(stack[0]);
assertEquals(1, stack.length);
}

We may want to expose some test.assertEquals to Lua from the test wrapper.

Change default allocator

Original issue 25 created by lua-alchemy on 2008-12-20T17:23:07.000Z:

We may make Lua run faster if we change default allocator. (This is
not for first Lua Alchemy versions of course.)

Lua allocates a lot of small fixed-size chunks for tables.

One allocator that works nice with Lua (per user reports) is dmalloc:

http://g.oswego.edu/dl/html/malloc.html

Need to experiment with that once benchmarks would be ready.

Break code modules out of lua_wrapper.gg

Original issue 1 created by lua-alchemy on 2008-12-19T05:19:44.000Z:

lua_wrapper.gg is getting too long and hard to manage

  • bridge_as3_c.c/h - The C<->AS3 bridge helper functions
  • bridge_lua_c.c/h - Any Lua<->C bridge helper funcitons
  • bridge_as3_lua.c/h - Any AS3<->C bridge helper functions
  • callbacks_as3_lua.c/h - Handle creation and management of Lua function
    callbacks returned on stack

Cleanup TODOs on Wiki

Original issue 15 created by lua-alchemy on 2008-12-19T23:01:53.000Z:

Remove all TODOs from Wiki and put them here in Issues

Lua version?

Which version of lua does lua alchemy use? I've been all over the google project page and this one and can't seem to find it. I'm assuming 5.1.

Implement sztracef()

Original issue 14 created by lua-alchemy on 2008-12-19T22:56:21.000Z:

Implement vsprintf-based sztracef() wrapper on sztrace() to be used in
debug output

Enhance as3.tolua

Original issue 41 created by lua-alchemy on 2008-12-22T20:05:21.000Z:

  1. Ignore (pass through) non-as3 types.
  2. Convert all arguments passed (make variadic).

Split lstack.h

Original issue 34 created by lua-alchemy on 2008-12-20T23:22:42.000Z:

Extract Pdumpstack body to lstack.c

Simplify code dealing with stack

Original issue 22 created by lua-alchemy on 2008-12-20T12:12:20.000Z:

Must not iterate over stack withot popping. Must work with stack as with
stack -- only pushes and pops. Current situation gives us a lot of grief.

Rewrite those as3_value_from_lua_stack() etc.

Implement "virtual file system" so Lua has some "file" access

Original issue 24 created by lua-alchemy on 2008-12-20T17:14:43.000Z:

To allow comfortable reuse of existing Lua code with Lua Alchemy, we
must support following functions:

  • loadfile()
  • dofile()
  • require() and package.* for Lua sources
  • require() and package.* for Lua C (or other language) shared
    library modules, compiled in Alchemy.

This proposal also affects these functions:

  • io.open()
  • io.input()
  • io.output()
  • io.tmpfile()
  • os.remove()
  • os.rename()

I propose to put "virtual file system" wrapper on the file (both code
and data) access. VFS targets:

  • Files, bundled into the current SWF (read-only). Should be
    configurable from Lua, C and/or ActionScript so prefix could be
    removed to ease porting of existing sources:

    dofile("thisswf://path/file.lua")
    local file = assert(io.open("thisswf://path/data.dat", "r"))
    AS3.io_set_default_prefix("thisswf://path")
    dofile("file.lua") -- same file as above

Default prefix setting should support all of available options. Note
from the Lua point of view AS3.io_set_default_prefix("path") is
conceptually the same as os.exec("cd path").

  • Files, bundled into other SWFs (read-only; available SWFs added with
    special API function from Lua, C and/or ActionScript). TODO: Ensure
    that no AS3 SWF load specifics would inhibit this.

    AS3.io_add_swf("swf-name", "URI")
    dofile("swf://swf-name/path/file.lua")
    local file = assert(io.open("swf://swf-name/path/data.dat", "r"))

  • Files, located on the local Flash storage (read/write).

    dofile("storage://path/file.lua")
    local file = assert(io.open("storage://path/data.dat", "r+"))

NOTE: Loading code from local storage seems to be silly and
insecure. Probably we should disable it.

  • Files, uploaded by user with open/save file dialog (read for
    open/write for save).

    dofile("open://") -- A lua script runner
    local read_file = assert(io.open("open://", "r"))
    local write_file = assert(io.open("save://", "w"))

NOTE: I do not like this filename-less notation much. Any ideas?

TODO: There could be problems with that save:// files would likely
to allowed to save only once. So the actual save is to be done only
when handle is closed.

  • Files, located in the file system (read/write within sandbox limits;
    no limits in console mode).

    dofile("file:///Users/Me/myfile.lua")
    local file =
    assert(io.open("C:\Windows\system32\drivers\etc\hosts", "r+"))

Lua's require() does not separate shared library modules from the
plain Lua modules. See
[http://www.lua.org/manual/5.1/manual.html#pdf-require docs] on how it
works.

We should replace package.loaders contents with our functions which
know about our VFS. Once we have that and have working loadfile(),
all would have to do is implement
[http://www.lua.org/manual/5.1/manual.html#pdf-package.loadlib package.loadlib] to load shared libraries -- this should be enough.

Ensure Lua Alchemy's Lua bytecode dumps are not dependent on user machine endianness

Original issue 40 created by lua-alchemy on 2008-12-22T13:23:23.000Z:

save: local str = string.dump(function() return "BOO!" end)
load (on other-endian machine): assert(assert(loadstring(str))() == "BOO!")

Quote from Duncan Cross:

Should Lua bytecode generated by Lua Alchemy be compatible across all
browsers/platforms (to be run by another instance of Lua Alchemy), or are
there still possible endianness compatibility problems? I understand that
Lua's function dump relies on the endianness of the machine that's running
it on, making it nonportable. From what I know of ActionScript ByteArrays,
they do have an "endian" property for reading and writing various number
types, but what I don't know is whether this defaults to the native
endianness or has a fixed default, or whether this is even relevant in Lua
Alchemy's case.

Improve build speed

Original issue 18 created by lua-alchemy on 2008-12-19T23:11:51.000Z:

Looks like jvm is started more than once. There may be workarounds

Create common ant build script

Original issue 32 created by lua-alchemy on 2008-12-20T22:45:32.000Z:

Most of the test/FluintLuaTests and demo/LuaAlchemyDemo build.xml files are
identical. Extract common ant code to make creation of new projects easier.

Cleanup Lua function callbacks so after luaClose() we don't try to run old lua_state functions

Original issue 7 created by lua-alchemy on 2008-12-19T05:52:54.000Z:

What steps will reproduce the problem?

  1. Run the Box test in the demo multiple times

What is the expected output? What do you see instead?

Expected: The box should move smoothly.

Actual: The box jumps around because we are receiving multiple timer events
and running the same function for each.

Memory addresses are reused in Alchemy so tracking pointers won't work.
Need each lua_state to track all of their function callbacks, verify they
are valid when calling them, and then cleanup when complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.