I get this error when i try to get data from a dataTable on a lua plugin, but a couple of lines before I did the same and it works.Code:[Oxide] 7:51 PM [Error] Failed to call hook 'cmdBancoBack' on plugin 'Banco Vip ' File: BancoVip.lua Line: 233 attempt to index field '?' (a nil value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
In line 233 I have this code: "local x = dataTable [playerID].Back.x ", and I can see the data is saved on the .json file
Solved Error when trying to get data from a dataTable lua
Discussion in 'Rust Development' started by cibal, Aug 10, 2015.
-
Are `playerID`, `Back` and `x` properly formatted as keys for the data table construct/array? Not sure about Lua, but in most languages they should be purely alpha-numeric. "A nil value" says to me that either `playerID`, `Back` or `x` is not initialized properly in you code.
-
Thx I have initialized it on pluginInit but not when calling the chat command