Wednesday, July 28, 2010

Lua C-API

Yesterday I've restarted to develop a rts-game from the scratch. I've decided to use LUA as script engine. Because I want use C++ as programming language, I wrote a binder class to bind C++-Classes with Lua-Metatables. The first thing I needed to learn was that you can't call all functions of the C-API directly. Some of them must be called during a lua-call. If they be called directly you will often get an error like "PANIC: unprotected error in call to Lua API (no calling environment)" and your application will crash immediately. It tooks a long time until I noticed that I can't call
lua_replace(L, LUA_ENVIRONINDEX);
directly so I must use
lua_setfenv(L, -1);
if I want to set the current table as environment table. You will get the same error message if you try to load single libs (luaopen_..) directly. You must use luaL_openlibs or open it during a lua call.

Greetz,
BlueC0re

Thursday, July 15, 2010

ARM - Reverse Engineering

I've spended the hole day with reverse engineering of a little application on my mobilephone. It was the first time I've been working with ARM-Assembler. Now, after a couple of hours I was successful. I have found the functions which I had been looking for and I was able to bring them back in a higher programming language.

Some important things in ARM: