Jump to content

table.concat


itHyperoX

Recommended Posts

  • Administrators

You don't. You need the command syntax to be different, such as:

/oxquestion This is the question text|This is the answer text

 

addCommandHandler("oxquestion",function(player, cmd, ...)
  local t = table.concat({ ... }, " ")
  local questionTable = {}
  local answerTable = {}
  local switch = false
  for i,v in ipairs(t) do
    if v == "|" then 
      switch = true 
    else
      if switch then
        table.insert(answerTable, v)
      else
        table.insert(questionTable, v)
      end   
    end 
    table.remove(t, i)     
  end
end)

"|" is the separator for question/answer.

Edited by LopSided_
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...