The International Simutrans Forum

 

Author Topic: Registration of Squirrel Standard Library  (Read 147 times)

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH

  • Coder/patcher
  • Devotee
  • *
  • Posts: 368
  • Languages: JP,EN
Registration of Squirrel Standard Library
« on: June 30, 2020, 03:04:19 PM »
Squirrel provides Squirrel Standard Library that enables us to use basic I/O, string and math functions. However, these need a registration in the C++ code to use them in a squirrel code. For example, the I/O library needs the execution of sqstd_register_iolib. Current simutrans does not seem to do this routine and the Standard Library is unavailable.

It would be useful if I can use the Standard Library in squirrel code. Is there any reason not to support them in Simutrans?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4702
  • Languages: EN, DE, AT
Re: Registration of Squirrel Standard Library
« Reply #1 on: July 01, 2020, 05:20:34 AM »
Parts of this lib are used: math, string, and system. I did not see a reason to also register the other parts. Why do want to use this?

Offline makie

  • Devotee
  • *
  • Posts: 194
    • Homepage PAK128-German
  • Languages: DE
Re: Registration of Squirrel Standard Library
« Reply #2 on: July 01, 2020, 07:29:59 AM »
Quote
the I/O library
Open I/O, open a security problem. You can read and write files on the PC of the player. Maybe you want read some information from file in a script.
But this can be miss used too.

Offline THLeaderH

  • Coder/patcher
  • Devotee
  • *
  • Posts: 368
  • Languages: JP,EN
Re: Registration of Squirrel Standard Library
« Reply #3 on: July 01, 2020, 12:48:39 PM »
Yes, I want to use the I/O library to extract some information of games as a file and use them with external programs, only with squirrel scripts. However, I have to admit that supporting I/O brings a security problem as makie put it.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: Registration of Squirrel Standard Library
« Reply #4 on: July 01, 2020, 01:50:56 PM »
One could force the files to be limtied to the simutrans directory by forbidding any path characters like /\:,; or so.