Jump to content
  • Advertisement

Recommended Posts

I have only a very basic LUA knowledge, I use it merely as something slightly above configuration file.

I have this problem, I run a LUA file (luaL_loadfile() then lua_pcall()) and when there is some syntax error (like misspelled function name) I only get a generic "communication error" without mentioning the line of the error (which alone would solve the problem for me). I tried to google the solution but could not really find anything useful... Which is weird :)

So, how to make it return the line of the error in LUA script?
 

 

Share this post


Link to post
Share on other sites
Advertisement
std::string errorMsg = "";

if (luaL_dofile(L, fullFilename.c_str()))
{
	errorMsg = lua_tostring(L, -1);
}

 

Share this post


Link to post
Share on other sites
12 minutes ago, VoxycDev said:

std::string errorMsg = "";

if (luaL_dofile(L, fullFilename.c_str()))
{
	errorMsg = lua_tostring(L, -1);
}

 

... LOL, that was trivial indeed :) I wish I asked a few months ago :D

Big thanks VoxycDev!

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

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

GameDev.net 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!