bennyxqg / lua-alchemy

Automatically exported from code.google.com/p/lua-alchemy
0 stars 0 forks source link

Troubles with luaAssets #131

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Convert some flixel example to Lua Alchemy? (Or write new one)

Original issue reported on code.google.com by aglad...@gmail.com on 11 May 2010 at 9:47

GoogleCodeExporter commented 9 years ago
Maybe port this one? http://github.com/AdamAtomic/EZPlatformer/tree/master/src/

Original comment by aglad...@gmail.com on 13 May 2010 at 10:26

GoogleCodeExporter commented 9 years ago
Hello,

I'm trying to integrate LuaAlchemy with Flixel but I get an error when trying 
to initialize Lua interpreter (I'm using the lua-alchemy-0.2.2.swc from this 
Google Code site). Please take a look at the code in this repository:

http://github.com/goshki/CrateCollector/blob/lua-alchemy-integration/src/main/ac
tionscript/pl/vigeo/test/MenuState.as

As you can see I try to initialize the LuaAlchemy when the I key is pressed:

if ( FlxG.keys.justPressed( "I" ) ) {
    initLua();
}

with such code:

private static function initLua():void {
    try {
        if ( lua ) {
            lua.close();
            lua = null;
        }
        lua = new LuaAlchemy();
        lua.setGlobal( "FlxG", FlxG );
    }
    catch ( error:Error ) {
        FlxG.log( "Lua init error:" + error );
    }
}

But when I press this key, I get the error as below:

ReferenceError: Error #1065: Variable luaAlchemy::LuaAssets__asset0 is not 
defined.

Every successive I keypress gives Error #1009.

I belive I'm making some mistake in the way I integrate LuaAlchemy into my 
project but I'm not sure what it can be. I'd be glad if you gave me any hint. 
:-)

Original comment by gos...@gmail.com on 21 Apr 2011 at 12:19

GoogleCodeExporter commented 9 years ago
What platform are you trying to do this on? (OS X / Linux / Windows?)

Original comment by aglad...@gmail.com on 21 Apr 2011 at 12:42

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 21 Apr 2011 at 12:42

GoogleCodeExporter commented 9 years ago
I'm compiling on Linux using MXMLC from latest stable Flex SDK 4.1.0.16076. As 
of now, I've managed to get Lua interpretter running and executing code but 
only through plain lua_wrapper calls (as can be seen in test-cases in 
test/FluintLuaAlchemyTests/src/wrapperSuite/tests/TestAS3LuaInterface.as).

Original comment by gos...@gmail.com on 21 Apr 2011 at 1:13

GoogleCodeExporter commented 9 years ago
Also, please do not hijack tickets. I'm glad to help, but you really should 
have created a separate one for this issue. :-)

About the issue: try adding LuaAssets class. 

See 
https://github.com/lua-alchemy/lua-alchemy/blob/master/demo/MiniDemo/src/LuaAsse
ts.as

Note that in most of examples it is auto-generated

https://github.com/lua-alchemy/lua-alchemy/blob/master/demo/Rapid/build.xml#L74

It is rather strange that this error happens when you do not have this class. I 
will look into it more.

Original comment by aglad...@gmail.com on 21 Apr 2011 at 1:17

GoogleCodeExporter commented 9 years ago
Nope, looks like I'm wrong. Just built an LuaAssets-less demo without 
problems... Maybe there is something wrong with your build pipeline?

Do you use your build.sh or build with FlashBuilder?

Original comment by aglad...@gmail.com on 21 Apr 2011 at 1:55

GoogleCodeExporter commented 9 years ago
Sorry for hijacking the ticket. ;-)

I'm building with a bash script. It looks like this:

mxmlc -debug -warnings -strict -optimize -incremental 
-l+=../lua-alchemy/lua-alchemy-0.2.2/lua-alchemy-0.2.2.swc 
-sp=src/main/actionscript -sp+=../flixel/2.50-dev src/main/actionscript/Main.as

Original comment by gos...@gmail.com on 21 Apr 2011 at 2:02

GoogleCodeExporter commented 9 years ago
Unfortunately I'm not fluent with mxmlc command-line options... But I may try 
running this on my side if you send me dependency swcs  (you have a lot of them 
there...) or, better, a minimal example to reproduce

Meanwhile, please try building with attached swc. Note that it is from the 
development version 
(https://github.com/lua-alchemy/lua-alchemy/blob/ag%2Fprimitive-autoconversion/H
ISTORY), couple of things changed, but you should not be affected by them.

Original comment by aglad...@gmail.com on 21 Apr 2011 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:00

GoogleCodeExporter commented 9 years ago
Moved original ticket to #143

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Oops, forgot the attachment.

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:02

Attachments:

GoogleCodeExporter commented 9 years ago
Also, see new NoAssets demo, it may be helpful:

https://github.com/lua-alchemy/lua-alchemy/tree/ag%2Fprimitive-autoconversion/de
mo/NoAssets

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:06

GoogleCodeExporter commented 9 years ago
Unfortunately the attached SWC does not solve the problem. But until now I've 
managed to initialize LuaAlchemy with a little hack: in my source code I've 
overriden a file luaAlchemy.LuaAssets by creating the same file in the same 
package (so technically I've overriden luaAlchemy.LuaAssets from the 
lua-alchemy-0.2.2.swc). Then I got error about missing file 
builtin://lua_alchemy.lua, so I've addedd a .lua file under such path in my 
LuaAssets. That made LuaAlchemy finally initialize itself, but when I gave it a 
file using Lua Sugar it reported a campile error. Thus I belive there is some 
problem with LuaAssets class in the lua-alchemy-0.2.2.swc but I cannot confirm 
that yet. Apparently the builtin .lua files are somehow  inaccessible/invisible 
when compiling on Linux. This evening I'll try to compile it on Windows and 
I'll give you feedback.

Original comment by gos...@gmail.com on 21 Apr 2011 at 3:25

GoogleCodeExporter commented 9 years ago
Thank you for the feedback. The symptoms are really strange. I will poke around 
on my side as well, this should not happen.

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was able to reproduce the problem. Try adding 
-static-link-runtime-shared-libraries=true option to mxmlc and see if this 
helps.

Original comment by aglad...@gmail.com on 21 Apr 2011 at 3:44

GoogleCodeExporter commented 9 years ago
You were right, everything works now! Thank you very much and if you'd be 
interested I'd be glad to provide a Flixel/LuaAlchemy integration example, so 
this ticket is not hijacked anymore. :-)

Original comment by gos...@gmail.com on 21 Apr 2011 at 8:32

GoogleCodeExporter commented 9 years ago
I'm glad that worked.

I am interested, please do contribute! :-)

Original comment by aglad...@gmail.com on 21 Apr 2011 at 8:34