diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 | |||
2275 | { | 2275 | { |
2276 | lua_State *L; | 2276 | lua_State *L; |
2277 | int err; | 2277 | int err; |
2278 | char *ext; | ||
2278 | 2279 | ||
2279 | fprintf(out, "--// Generated code goes here.\n\n"); | 2280 | fprintf(out, "--// Generated code goes here.\n\n"); |
2280 | fprintf(out, "local _bit = require(\"bit\")\n"); | 2281 | fprintf(out, "local _bit = require(\"bit\")\n"); |
2281 | fprintf(out, "local _LSL = require(\"LSL\")\n\n"); | 2282 | fprintf(out, "local _LSL = require(\"LSL\")\n\n"); |
2282 | fprintf(out, "local _SID = [=[%s]=]\n\n", compiler.SID); | 2283 | fprintf(out, "local _SID = [=[%s]=]\n\n", compiler.SID); |
2284 | strcpy(buffer, basename(compiler.fileName)); | ||
2285 | if ((ext = rindex(buffer, '.'))) | ||
2286 | ext[0] = '\0'; | ||
2287 | fprintf(out, "local _scriptName = [=[%s]=]\n\n", buffer); | ||
2283 | outputLeaf(out, OM_LUA, compiler.ast); | 2288 | outputLeaf(out, OM_LUA, compiler.ast); |
2284 | fprintf(out, "\n\n_LSL.mainLoop(_SID, _defaultState)\n"); // This actually starts the script running. | 2289 | fprintf(out, "\n\n_LSL.mainLoop(_SID, _scriptName, _defaultState)\n"); // This actually starts the script running. |
2285 | fprintf(out, "\n--// End of generated code.\n\n"); | 2290 | fprintf(out, "\n--// End of generated code.\n\n"); |
2286 | fclose(out); | 2291 | fclose(out); |
2287 | 2292 | ||