PDA

View Full Version : Simple Lua Concatenation


Osiris.Envy
07-20-2015, 12:24 PM
How can I concatenate a charid into a Lua string? (I'll use a simple example to illustrate my question)


The following Lua script works great to output "NPC says, Osiris_rueda_status"



function event_say(e)
if (e.message:findi("hail")) then
e.self:Say("" .. e.other:GetName() .."_rueda_status");
end
end



How can I get the Lua output to use the charid and not the char name?

The desired output would be, "NPC says, 147_rueda_status" (where 147 is the id from the character_data table)

I can do this with Perl



sub EVENT_SAY {

if ($text=~/hail/i){
$client->Message($TextColor, " ");
plugin::Whisper($charid.'_rueda_status');
}
}



However, for what I want to accomplish I need the desired output to come from a Lua script


Thanks,

Osiris

NatedogEZ
07-20-2015, 02:47 PM
e.self:Say("" .. e.other:CharacterID() .."_rueda_status");



You just want character ID?


You can get more lua info here as well. :)

https://github.com/EQEmu/Server/wiki/Lua-Parser

http://wiki.eqemulator.org/p?Lua_Parser&frm=Main

demonstar55
07-20-2015, 04:53 PM
e.self:Say(tostring(e.other:CharacterID()) .. "_rueda_status")

That should work.

Osiris.Envy
07-22-2015, 01:49 AM
thx for the replies - I am now getting the desired output