lua-users home
lua-l archive

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


I have converted my code to use lua_pcall, and to print the error messages.
Works great. Thanks. But I still can't figure out loadfile. I'm loading a
script like this:

if (luaL_loadfile(L, filename) != 0)
{
	// Error occurred
	cout << "Error occurred: " << lua_tostring(client_state, -1);
}

where filename is of course a string containing the file name. But this seems
to do nothing at all. The call to luaL_loadfile does not fail, it just doesn't
load the file. Subsequent calls to functions the script is supposed to define
fail with the message 'attempt to call a nil value'. What am I doing wrong?

Thanks, Philip Bock