View Single Post
09-11-18, 12:08 AM   #1
Gilsuk
A Murloc Raider
Join Date: Sep 2018
Posts: 4
Can It be possible to edit namespace

example.toc
Code:
## Title: example
## Interface: 80000
## blah~

exp1.lua
exp2.lua
exp1.lua
Lua Code:
  1. local _, ns = ...
  2. ns["player"].name = UnitName("Player")

exp2.lua
Lua Code:
  1. local _, ns = ...
  2. print(ns["player"].name) -- It works!
  3. ns["player"].name = "Wrynn" -- It also works!
  4. ns["player"].class = "WARRIOR" -- It doesn't work. It fires nil value error

exp2.lua can access and edit the value that was already defined in exp1.lua.
but exp2.lua can't define a new variable into the table 'ns'

Other addons can do this like It was nothing. so I don't know what are the problems with my codes...
  Reply With Quote