[SOLVED] local myTestImport = require "MyDirectory/MyFile" -- Throws exception
THE PROBLEM
I'm trying to refactor my old AddOn into multiple files. When I run `> lua MyAddon.lua` from the command line, it runs as expected, spitting out "Hello World". However, I get the familiar "function expected instead of nil" error when the UI loads. My directory structure: Code:
Elder Scrolls Online\live\AddOns Lua Code:
And `MyFile.lua` contains Lua Code:
THE SOLUTION There was more wrong with my code than I thought. Here's what worked: `MyAddon.txt` contains Code:
## Title: MyAddon Lua Code:
And `MyFile.lua` contains Lua Code:
|
Lua in eso is not allowing to use directory or file commands like require!
Just include the files to load in the manifest txt file of your addon and define a global variable like myAddonNamespace ={}. In your example this would be myTestImport = {} and then e.g. myTestImport.helloWorldText = "Hello World" and then in the other file do d(myTestImport.helloWorldText) and add your needed variables and functions in different files to it. |
Quote:
|
All times are GMT -6. The time now is 09:56 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI