Skip to content

How to import an external library (I want pcre)

KahenrazKahenraz Member Posts: 70
edited April 2017 in UI Modding
When I work with regular expressions I want them to be pcre (Perl Compatible Regular Expressions) and this requires importing a library; rex_pcre in this case.

The library imports fine with a normal Lua interpreter but trying to add it to UI.MENU causes BG to crash:

regex = require("rex_pcre")
---------------------------
Error
---------------------------
There was an error. A crash report was saved to:

C:\Users\Matthew D'Onofrio\Documents\Infinity Engine - Enhanced Edition\crash\dump.2.3.67.3.0008.dmp

Please contact support@beamdog.com
---------------------------
OK   
---------------------------
Is it not possible to import external libraries? :(

Edit:

I just realized that this may be due to my building the library for the wrong version of Lua. Does anyone know what version specifically is used in BG? I had originally compiled for 5.1.

Comments

  • argent77argent77 Member Posts: 3,433
    A quick look into the game executable of PST:EE reveals the string "Lua 5.2". However, I wouldn't rely on that since every new game patch can make changes to the included Lua.
  • KahenrazKahenraz Member Posts: 70
    I don't think it's possible at all. I tried adding the line to M_BG.lua and I get the following error at startup:

    attempt to class global 'require' (a nil value)


    That's too bad. I really, really want my Perl regular expressions to filter item drops.
Sign In or Register to comment.