Advertisement

[LUA] Debugging

Started by April 02, 2019 08:17 PM
2 comments, last by Acharis 5 years, 7 months ago

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?
 

 

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube


std::string errorMsg = "";

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

 

Advertisement
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!

 

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

This topic is closed to new replies.

Advertisement