1

I try to import some package using "require"... because of the Squirrel-lang coming from Lua.

But I found that both there is nonthing in both "squirrel3" and "sqstdlib3"..

So I do it like this :

// foo.nut

local foo = {}

return foo
// main.nut

local foo = loadfile("foo.nut")

foo.bar()

Also, there is no "dostring"

..... Do I need to implement a package manager myself?

Lunoctis
  • 13
  • 2

2 Answers2

0

Try checking out https://github.com/inlife/squirrel-require, might work for you.

Inlife
  • 51
  • 1
  • 3
0

dofile should do the trick (documented here).

I tried the following:

// foo.nut
local foo = {function bar(){print("bar!")}}
return foo

and

// main.nut
local foo = dofile("foo.nut")
foo.bar()

then got this result:

C:\Users\me\squirrel3\bin>sq.exe main.nut
bar!
C:\Users\me\squirrel3\bin>
Astrofra
  • 321
  • 4
  • 12