Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

maria maria maria

lua and c where canI find some examples?

This topic is 5556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here''s a pretty simple example to get you started, call this luatest.c

#include <stdio.h>

extern "C" {
#include "lua.h"
#include "lualib.h"

/* the Lua interpreter */
lua_State* L;

int main ( int argc, char *argv[] )
/* initialize Lua */
L = lua_open(0);

/* load Lua libraries */

/* run a script */
lua_dofile(L, "test.lua");

/* cleanup Lua */

return 0;

Then create a lua file and call it test.lua

-- simple test

print "Hello, World!"

Let me know what operating system you''re using and I''ll try to help you get it compiled.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!