Closed GoogleCodeExporter closed 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
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
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
Original comment by aglad...@gmail.com
on 21 Apr 2011 at 12:42
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
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
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
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
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
Original comment by aglad...@gmail.com
on 21 Apr 2011 at 3:00
Moved original ticket to #143
Original comment by aglad...@gmail.com
on 21 Apr 2011 at 3:01
Oops, forgot the attachment.
Original comment by aglad...@gmail.com
on 21 Apr 2011 at 3:02
Attachments:
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
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
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
[deleted comment]
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
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
I'm glad that worked.
I am interested, please do contribute! :-)
Original comment by aglad...@gmail.com
on 21 Apr 2011 at 8:34
Original issue reported on code.google.com by
aglad...@gmail.com
on 11 May 2010 at 9:47