Hello Guest

Try to add a new external DDL

  • 3 Replies
  • 319 Views
*

Alan1995

  • *
  • 3
  • +0/-0
    • View Profile
Try to add a new external DDL
« on: November 16, 2018, 11:51:56 am »
I am trying to get added an external library DLL to be called inside the Dicebot script.
This is meant to work inside the "programmer mode" of DiceBot.

The DLL has been copied inside the main folder/directory of DiceBot (namely "csv.dll")
I then call the library inside of the LUA Dicebot script through:

require 'csv'     
.......
.......

NB: The above "require" LUA instruction has been put at the beginning of the DiceBot script before any other initialization.

However when I launch the script I get the following error:

start()
LUA ERROR!!
Could not load file or assembly 'file:///C:\Programs\DiceBot 3.3.22\csv.dll' or one of its dependencies. The module was expected to contain an assembly manifest.


It seems that there are some global path variables (LIBPATH or something else) to be properly settled in order indicate to DiceBot interpreter where finding the DLL file because it seems that DiceBot does not check for DLL file inside its own main folder/directory.

Please note that the same script with additional LUA functions (that I do not put here in order to avoid confusion because not pertinent) has been tested in a separate LUA environment (same computer) and this works perfectly. So it is sure that the issue is related only to the way DiceBot looks for the DDL files.

Can you please help to fix this issue giving advices on how to properly set possibly the system path variables?

Thank you in advance for your help

Alan



*

Seuntjie

  • *****
  • 138
  • +0/-1
    • View Profile
Re: Try to add a new external DDL
« Reply #1 on: November 17, 2018, 09:01:41 am »
I'm talking from memory here, I will have to investigate to be 100% sure.

DiceBot does not hanlde references for the LUA environment, LUA handles it itself. The version of LUA used in the bot is fairly old (it's not trivial to update to the newest version, otherwise I would have by now). It's very possible that the version of LUA of that specific lua library does not support the functionality that you're trying to use.

Edit: The problem is your csv file. the lua environment checks various folders and it finds your file.

Read your error message: Could not load file or assembly 'file:///C:\Programs\DiceBot 3.3.22\csv.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
It finds your file, but the file is not valid. It's not a DLL but has a DLL extension.

If the bot could not find the file, it would say:
module 'csv' not found:
   no field package.preload['csv']
   no file '.\csv.dll'
.
.
.
 etc

Again, this might work in your other lua environment and not in DiceBot because DiceBot is using an older version of LUA. It might even just be a different implementation of LUA and does not have anything to do with the version.

*

Alan1995

  • *
  • 3
  • +0/-0
    • View Profile
Re: Try to add a new external DDL
« Reply #2 on: November 17, 2018, 10:47:14 am »
Thank you for your explanation!

Since I have also the "c source code" of such "csv" library, I could try to recompile the C source in a compatible method with the old version of LUA that DiceBot is using.

Could you please indicate me what is the version of LUA that DiceBot is currently using?

Thanks in advance!

*

Seuntjie

  • *****
  • 138
  • +0/-1
    • View Profile
Re: Try to add a new external DDL
« Reply #3 on: November 18, 2018, 08:01:10 am »