Functions Called by Main Program

a13wa13w Join Date: 2010-01-07 Member: 69966Members
Greetings,

I was browsing through the Lua code recently released in the engine test and took specific note of the OnProcessMove function in the Player file which seems to handle user input. I searched all the other Lua files and found that it is not called by anything. My only guess is that it is called somewhere in the main exe. I assume that certain functions are called by the main exe and thus are the "start" points for all Lua code.

Am I right in this assumption?

Comments

  • DixieWolfDixieWolf Join Date: 2010-02-10 Member: 70508Members
    <!--quoteo(post=1766453:date=Apr 12 2010, 10:07 PM:name=a13w)--><div class='quotetop'>QUOTE (a13w @ Apr 12 2010, 10:07 PM) <a href="index.php?act=findpost&pid=1766453"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Greetings,

    I was browsing through the Lua code recently released in the engine test and took specific note of the OnProcessMove function in the Player file which seems to handle user input. I searched all the other Lua files and found that it is not called by anything. My only guess is that it is called somewhere in the main exe. I assume that certain functions are called by the main exe and thus are the "start" points for all Lua code.

    Am I right in this assumption?<!--QuoteEnd--></div><!--QuoteEEnd-->
    lua can be loaded as a C library, so the actual heavy lifting on the low level is done in C++, and several key functions are likely bound from inside the actual C-layer of the engine
  • a13wa13w Join Date: 2010-01-07 Member: 69966Members
    <!--quoteo(post=1766454:date=Apr 12 2010, 06:10 PM:name=DixieWolf)--><div class='quotetop'>QUOTE (DixieWolf @ Apr 12 2010, 06:10 PM) <a href="index.php?act=findpost&pid=1766454"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->lua can be loaded as a C library, so the actual heavy lifting on the low level is done in C++, and several key functions are likely bound from inside the actual C-layer of the engine<!--QuoteEnd--></div><!--QuoteEEnd-->

    By bound do you mean utilized by the actual c++ code?

    And is it possible to determine which functions are actually utilized by the C++ code without looking at the source code?
  • rsdrsd Join Date: 2003-02-11 Member: 13405Members
    <!--quoteo(post=1766456:date=Apr 13 2010, 04:15 AM:name=a13w)--><div class='quotetop'>QUOTE (a13w @ Apr 13 2010, 04:15 AM) <a href="index.php?act=findpost&pid=1766456"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->By bound do you mean utilized by the actual c++ code?

    And is it possible to determine which functions are actually utilized by the C++ code without looking at the source code?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Easiest is top open all the lua files in a program like Notepad++ then search across all files for a specific function name E.g. OnProcessMove

    If you can't find the function being called anywhere else its either not in use or called by the C++ code. Should be obvious which is the case based on what the function does.

    I don't know of any way to generate a full list or anything like that.
  • DrMonDrMon Join Date: 2010-03-13 Member: 70948Members
    There are indeed methods to discover functions like this - But I'm not sure if we are allowed to discuss it. It involves reverse-engineering and I'm not sure of UWE's stance on that even if the intentions are good (i.e Finding functions like these to use in modding).

    If someone from UWE could comment on their stance I'd be most interested to hear it!
  • DixieWolfDixieWolf Join Date: 2010-02-10 Member: 70508Members
    when the engine is officially finished, i'm certain they'll have API documentation on all of this anyway. So it just means that for now, when we're fooling with the engine test, we'll just have to find them through trial and error. It would be nice to post up anything we find though, so maybe we could get a list, just for now. There were a few I found earlier, but I'm not looking at the code now, so i'll have to check it later
  • a13wa13w Join Date: 2010-01-07 Member: 69966Members
    My only concern is, when major scale mods being to be made, these "start" functions are going to determine how c++ interacts with the Lua code. Thus if they can change from update to update, it could cause many things to break. I guess we are going to have to wait for a developers comment on this.
  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
    I really wouldn't worry about that. The HL SDK had that problem all the time and it can be managed with due consideration. In the event where a minor change is needed, it can be done in a way that is backwards compatible.
  • BiglinesBiglines Join Date: 2003-12-07 Member: 24094Members, Constellation
    <!--quoteo(post=1766725:date=Apr 14 2010, 02:06 AM:name=a13w)--><div class='quotetop'>QUOTE (a13w @ Apr 14 2010, 02:06 AM) <a href="index.php?act=findpost&pid=1766725"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->My only concern is, when major scale mods being to be made, these "start" functions are going to determine how c++ interacts with the Lua code. Thus if they can change from update to update, it could cause many things to break. I guess we are going to have to wait for a developers comment on this.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I think they will protect some behaviour, so don't expect anything you make now to work in any other version of the game
  • M4573RM4573R Join Date: 2010-04-16 Member: 71434Members
    I too was just admiring the lua files. I'm jealous because I used lua in my last little game engine, and it was a pain. I ended up using Lunar and almost duplicated every function from c++ to lua for all my components. It looks like UW has a much better way of doing it. I'm still looking through the files to see exactly how much communication back to c++ they have.
  • AnthoniAnthoni Join Date: 2009-04-10 Member: 67129Members
    edited April 2010
    If you have Decoda it will map out the classes, and functions for you which is quite helpful.
Sign In or Register to comment.