From 8dffe12c4e80e3d58e7825530632880214ed04cd Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 22 Feb 2012 05:43:11 +1000 Subject: Implement llGetScriptName(). --- LuaSL/src/LuaSL_compile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'LuaSL/src/LuaSL_compile.c') diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 873e6c4..de103b7 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -2275,13 +2275,18 @@ boolean compileLSL(gameGlobals *game, Ecore_Con_Client *client, char *SID, char { lua_State *L; int err; + char *ext; fprintf(out, "--// Generated code goes here.\n\n"); fprintf(out, "local _bit = require(\"bit\")\n"); fprintf(out, "local _LSL = require(\"LSL\")\n\n"); fprintf(out, "local _SID = [=[%s]=]\n\n", compiler.SID); + strcpy(buffer, basename(compiler.fileName)); + if ((ext = rindex(buffer, '.'))) + ext[0] = '\0'; + fprintf(out, "local _scriptName = [=[%s]=]\n\n", buffer); outputLeaf(out, OM_LUA, compiler.ast); - fprintf(out, "\n\n_LSL.mainLoop(_SID, _defaultState)\n"); // This actually starts the script running. + fprintf(out, "\n\n_LSL.mainLoop(_SID, _scriptName, _defaultState)\n"); // This actually starts the script running. fprintf(out, "\n--// End of generated code.\n\n"); fclose(out); -- cgit v1.1