'_ is not part of the string library' Error... When it should be...
2 replies, posted
So I have been working on this code for a long time. It is a HEAVY modification to a leveling system that was already created. The back end is basically all remodelled at this point. Anyway, I am almost done but there is this one error that occurs. The code cannot seem to update the variables for the experience points because of this error:
[CODE][ERROR] gamemodes/falloutunlimited/plugins/levelup/sh_plugin.lua:234: attempt to index a string value with bad key ('levelup' is not part of the string library)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:301
3. increaseExperience - gamemodes/falloutunlimited/plugins/levelup/sh_plugin.lua:234
4. onRun - gamemodes/falloutunlimited/plugins/levelup/sh_plugin.lua:183
5. run - gamemodes/nutscript/gamemode/core/libs/sh_command.lua:145
6. parse - gamemodes/nutscript/gamemode/core/libs/sh_command.lua:180
7. Run - gamemodes/nutscript/gamemode/core/hooks/sv_hooks.lua:248
8. unknown - gamemodes/nutscript/plugins/chatbox/sh_plugin.lua:69
9. func - gamemodes/nutscript/gamemode/core/libs/thirdparty/sh_netstream2.lua:117
10. unknown - lua/includes/extensions/net.lua:32[/CODE]
Here is the code of the Function that actually increases the experience points:
[CODE] //THIS IS WHAT INCREASES THE EXPERIENCE
function levelup.increaseExperience( ply, amount )
if not ply.levelup then print("There is no ply.levelup "..ply) return end
ply.levelup.experience = ply.levelup.experience + amount
levelup.hud.addNote( ply, "Experience awarded! +" .. amount .. " EXP", Color( 205, 255, 0 ) )
print("I Made it Into Here!")
if levelup.hasEnoughExperience( ply, levelup.config.expPerLevel * ( levelup.getLevel( ply ) + 1 ) ) then
ply.levelup.level = ply.levelup.level + 1
ply.levelup.experience = 0
levelup.useEventPerks( ply )
levelup.hud.addNote( ply, "Level up! You are now on level: " .. ply.levelup.level, Color( 205, 255, 0 ) )
end
levelup.database.save( ply, ply:getChar():getID() )
levelup.sendData( ply )
end[/CODE]
I have been at this for hours but I can't seem to figure it out :I Some support would be greatly appreciated. I obviously have player initualization code that sets up the 'ply.levelup' table and the the subsequent coulmns level and experience. Maybe I'm missing somethng? Also if you need more code for context, let me know. Thanks.
The ply variable is a string.
[QUOTE=sannys;51584707]The ply variable is a string.[/QUOTE]
... oh my god... You are so right... I'm sorry I'm tired out of my mind.
Sorry, you need to Log In to post a reply to this thread.