Results 1 to 3 of 3

Thread: Script loading sequence

  1. #1
    Squire
    Join Date
    Jul 2008
    Posts
    12

    Default Script loading sequence

    Here's the pseudo-code to demonstrate how torque game builder run a script

    When main.lua is run
    Code:
    if(exist file main.lua)
    {
      if(exist file main.lua.comp) //the bytecode-compiled version of main.lua
      {
        if(main.lua.comp is up-to-date)//this is done by checking the last modified date
          loadAndRun(main.lua.comp)//use this because we can by-pass the compilation phase
        else
          compileAndRun(main.lua.comp)//update the compiled file
      }
      else//if there is no bytecode version
      {
        compileAndRun(main.lua.comp)//create it
      }
    }
    else//if main.lua is not found
    {
      if(exist file main.lua.comp)//search for the bytecode version
        loadAndRun(main.lua.comp)//run it
      else
        return error;
    }
    IMO Novashell should adopt this system
    It saves time since unedited script are compiled for faster loading. And by distributing only the compiled scripts, we can hide our source code from end-users. Script compilation in Lua is simple, you can refer to the source code of luac (the lua compiler) . Fortunately, in LUA ,the same function is used for running plain-text and precompiled script.

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    I totally agree, and that's pretty similar to how I would do it.

    But I was thinking to use main.lad or something instead of main.lua.comp because I'm afraid having two "."'s in a file name will cause problems somewhere on one of the platforms.

    Btw I had no idea TGB now works with lua, that's pretty cool, big step up from torquescript imo.

    It should be quick and painless to add, just haven't really worried about it yet but it is on the list.
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Squire
    Join Date
    Jul 2008
    Posts
    12

    Default

    Btw I had no idea TGB now works with lua, that's pretty cool, big step up from torquescript imo.
    No it doesn't I just somehow forgot the torquescript's extension so I used .lua instead and make up the .lua.comp thing

Similar Threads

  1. Loading
    By Cobra in forum Novashell Game Creation System
    Replies: 2
    Last Post: 06-26-2008, 09:43 AM
  2. Edit script bug
    By Pleng in forum Novashell Game Creation System
    Replies: 2
    Last Post: 03-14-2008, 11:02 AM
  3. Font loading and the characters
    By Anvilfolk in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 09-14-2007, 05:08 PM
  4. Host of Funeral Quest loading ByteVerify Trojan
    By hossmonkey in forum Funeral Quest
    Replies: 5
    Last Post: 08-31-2004, 08:26 AM
  5. need a little script help.
    By lancevance in forum Funeral Quest
    Replies: 4
    Last Post: 12-21-2003, 04:43 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •