Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

198 Neutral

About martin_bfg10k

  • Rank
  1. martin_bfg10k

    My blog is hosted at There is not much to see, because I just started it. Feel free to take a look, and comment.
  2. martin_bfg10k

    Lua/C Calling lua function from C, with table parameter

    As a personal rule, if I know how to solve something that somebody asked, I just try to help him, telling how I solved that problem. But if I have to do research just to help someone, then I just ignore the post. I don't have any problem sharing knowledge of something that I know.
  3. martin_bfg10k

    Lua/C Calling lua function from C, with table parameter

    Well, I tested this on iphone, sending touch events, and it is fast enough. I didn't notice any performance issue. If I disable sending events to lua, or enable it, the game runs always at 60 fps.
  4. martin_bfg10k

    Lua/C Calling lua function from C, with table parameter

    Thanks for the links, at the end I figured out how to pass tables as function parameters. With the previous lua example: function game.event(e) --process events here end Let's say I want to pass this table as parameter: {type="touchBegin", touch={x=10.0, y=20.0}} the C code would be like this (with all values hardcoded for simplicity) lua_getglobal(L, "game"); // Get the table "game" lua_getfield(L, -1, "event"); // Get the function lua_newtable(L); // new table that will be the parameters table for the function lua_pushstring(L, "touchBegin"); lua_setfield(L, -2, "type"); // table.type = "touchBegin" lua_newtable(L); // subtable that will hold the touch values lua_pushnumber(L, 10.0); lua_setfield(L, -2, "x"); // subtable.x = 10.0 lua_pushnumber(L, 20.0); lua_setfield(L, -2, "y"); // subtable.y = 20.0 lua_setfield(L, -2, "touch"); // table.touch = subtable //now, we have the table ready for use as a function parameter lua_call(L, 1, 0); // call event() with 1 parameter (the parameter table wich is in the top of the stack) lua_pop(L,1); // finally, pop the table "game", for keep the stack balanced Hope this can help.
  5. martin_bfg10k

    Lua/C Calling lua function from C, with table parameter

    Lua 5.1 Reference Manual [/quote] Well, with that, I can create an empty table, but I don't know hot to add diferent values to that table, like numbers, strings, and subtables, and later pass it as a parameter in the function call. Thanks.
  6. Hi. I need to call a lua function from C, with a parameter that will be a table. For example, I have this lua function: function game.event(e) --process event here end I want to pass a table parameter with different fields, for example: e = { type="TOUCH_BEGIN", { x = 10, y=10} } e = { type="ACCELEROMETER", { x=0.5, y=0.2, z=0.4} } For function calls with single parameters, I do something like this: lua_getglobal(L, "game"); // Get the table instance lua_getfield(L, -1, "event"); // Get the function lua_pushinteger(L, 1000); // pass 1000 as function parameter lua_pcall(L, 1, 0, 0); //call lua function The question is, how can I create a temp table, like the tables from the example, and pass it as a parameter? Thanks.
  7. martin_bfg10k

    iPhone 4 - OpenGLES 2.0 Texture Mapping

    There is a lot of tutorials about opengl-es 2.0 for iphone on the net. Also, there is a very good book, in my opinion, about opengl-es 2.0:
  8. martin_bfg10k

    SDL + OpenGL: Rendering A Cube

    The problems is that you didn't enabled the depth buffer. Add this in the top of your opengl_init(): glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); and add this to glClear: glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
  9. martin_bfg10k

    I can edit and delete threads?

    Quote:Original post by Pthalicus Have you actually tried to edit someone else's post? I tried to edit your post, to change one your uses of "the" to "that". However, it wouldn't let me stating only admins/mods can edit other users posts. Makes sense. Edited "the" to "that". Sorry for may bad english. And I have not tried to edit another post, just for fear to be banned or something like that :P
  10. martin_bfg10k

    I can edit and delete threads?

    Oh, I see. It's been a long time since I posted in GD, and I forgot I had that button. Thanks.
  11. For every thread that I open, in every post, I can see an edit button, and if I click it, I can edit it, and delete it. Is that normal? I just wanted to say it, because maybe there an error in the databases, or something.
  12. Hi guys. I was wondering if anybody here used maxscript in 3DMax. I been using blender from a long time ago, but now, I need to export mesh and bone data from Max. Anybody knows where can I find the max API, or something like that, because I can get a site with the maxscript api, all I get are tutorials and examples. Thanks.
  13. Anybody knows if the B3D file format can be used in comercial games? I take a look at the, and it says that documentation is in public domain, what I'm not sure, if the format itself can be used. Thanks.
  14. Quote:Original post by Mike.Popoloski Or, as one might ask, how long is a long dog? How hard is a hard cat? Well, according with this cat, his dog is long Johnson : :P
  15. Maybe you should send an e-mail to the forum admin.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!