lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm just starting to learn lua and thought I'd start with something simple, so 
I downloaded an example file and changed one line to remove an obsolete 
function call.  Here is the result.

#include <stdio.h>

#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"

/* the Lua interpreter */
lua_State* L;

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

	/* load various Lua libraries */
	luaopen_base(L);
        luaopen_table(L);
        luaopen_io(L);
        luaopen_string(L);
        luaopen_math(L);

	/* cleanup Lua */
	lua_close(L);

	return 0;
}

I compiles cleanly but gives me an error message when I run it...

PANIC: unprotected error in call to Lua API (no calling environment)

How do I provide a calling environment?

Mike