VE Lua Documentation

Press F to search!

onCallEvent

Definition


-- @/lua/vehicle/main.lua:344

-- various callbacks
function onCallEvent(funName, data)
  if type(funName) ~= "string" then
    return
  end

  local f
  local _, j = string.find(funName, ".", 1, true)
  if j then
    local m = _G[string.sub(funName, 1, j - 1)]
    if type(m) == "table" then
      f = m[string.sub(funName, j + 1)]
    end
  else
    f = _G[funName]
  end

  if type(f) == "function" then
    f(data)
  end
end

Callers