drop EvalLua and the commented-out Lua init leftovers

EvalLua had no callers anywhere in the tree — it converted a wide string
to UTF-8, ran it as a chunk and printf'd the error, which was the hook for
a developer console that is not wired up. It was the only user of stdio,
MemMan and windows.h in this file.

InitializeLua and ShutdownLua are live, called from InitOverhead and
ShutdownOverhead. The calls in InitializeGame and ShutdownGame were
commented out when they moved there; remove them, and the commented
ACCESSOR_TABLE block in InitializeLua that refers to a macro no longer
defined anywhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Marco Antonio J. Costa
2026-07-30 13:25:35 -03:00
committed by majcosta
co-authored by Claude Opus 5
parent 76eda883a5
commit 06b115a293
3 changed files with 0 additions and 44 deletions
-1
View File
@@ -18,7 +18,6 @@ typedef struct {
} LuaAttrib;
void InitializeLua( );
int EvalLua (const wchar_t* buff) ; // The return value is whether to clear the input line, not whether the call succeeded.
void ShutdownLua( );
extern luaL_Reg WStringMethods[];
-40
View File
@@ -1,9 +1,5 @@
#include <stdio.h>
#include <string.h>
#include <iostream>
#include "Lua Interpreter.h"
#include <windows.h>
#include "MemMan.h"
lua_State *L;
@@ -181,11 +177,6 @@ void InitializeLua( )
L = lua_open();
luaL_openlibs(L);
// Create the accessor metatable
// CreateLuaType( L, ACCESSOR_TABLE, LuaAccessors);
// lua_setglobal( L, ACCESSOR_TABLE); // We also want this class to be known to the script
// lua_pop(L, 1);
// Create a wide-character savvy string
CreateLuaType( L, "wstring", WStringMethods);
lua_setglobal( L, "wstring"); // We also want this class to be known to the script
@@ -196,37 +187,6 @@ void InitializeLua( )
LuaEnvironmentSetup( L);
}
int EvalLua (const wchar_t* buff) {
int error;
int newlen;
STR8 newstr = NULL;
// Since we get wide chars coming in, we need to convert to UTF8
newlen = WideCharToMultiByte( CP_UTF8, 0, buff, -1, newstr, 0, NULL, NULL);
newstr = (STR8) MemAlloc( newlen);
WideCharToMultiByte( CP_UTF8, 0, buff, -1, newstr, newlen, NULL, NULL);
error = luaL_loadbuffer(L, newstr, newlen-1, "line") ||
lua_pcall(L, 0, 0, 0);
MemFree( newstr);
if (error) {
const char *error = lua_tostring(L, -1);
int len = strlen( error);
if (len >= 7 && !strcmp( error + len - 7, "'<eof>'"))
{
lua_pop(L, 1); /* pop error message from the stack */
return FALSE;
}
printf( "%s\n", lua_tostring(L, -1));
lua_pop(L, 1); /* pop error message from the stack */
return TRUE;
}
return TRUE;
}
void ShutdownLua( )
{
if(L)