nimscripter icon indicating copy to clipboard operation
nimscripter copied to clipboard

make exported stuffs available in other scripts

Open doongjohn opened this issue 3 years ago • 1 comments

proc exportedHi = echo "hi"
exportTo(
  moduleName,
  exportedHi
)
const addins = implNimScriptModule(moduleName)
var intr = loadScript(
  script = NimScriptPath "./main.nims",
  addins = addins
)
# main.nims
import "./helper.nims"
hi()
# helper.nims
proc hi = exportedHi() # <-- error: this proc is unavailable

I want to make a nimscript helper module but I can't use the exported procs
I can use include instead but I want to avoid that.

Is there any way to achieve this? or do you know a better way to make a helper nimscript?

doongjohn avatar May 15 '22 12:05 doongjohn

https://github.com/beef331/nimscripter/blob/master/src/nimscripter.nim#L87-L90 Need a version that takes in a openarray[(string, VMAddins)] or similar and implements each per string.

beef331 avatar May 15 '22 19:05 beef331