1. how to use SELECT in lua?
     
  2. Code:
    local MySqlConnection = mysql.OpenDb("xxx.xxx.xxx.xxx", 3306, "xxxxxxxx", "xxxxxxx", "xxxxxxxx");
        local SqlBuilder = mysql.NewSql();
        SqlBuilder:Append("SELECT * FROM oxide_Test WHERE ID = '344';");
        local data = mysql.Query(SqlBuilder,MySqlConnection);
    you could try that.
     
  3. and then as the data from columns to extract? =)
     
  4. Sorry i don't know what lua's equivalent to python's yield() is.
     
  5. normally something like this should work:
    Code:
    function each(o)
       local e = o:GetEnumerator()
       return function()
          if e:MoveNext() then
            return e.Current
         end
       end
    end
    local db = mysql.OpenDb("localhost", 3306, "rust", "root", "")
    local sql = mysql.NewSql():Select("*"):From("test")
    local data = mysql.Query(sql, db)
    for entry in each(data) do
        for col in each(entry) do
            print(col.Key .. " - " .. col.Value)
        end
    end
    but it looks as if lua do not like yield return...result is empty/you can't loop over it...i've made changes to mysql and sqlite ext to make all languages happy, so code above will work with next oxide release...
     
  6. Code:
    [Oxide] 12:28 AM [Info] steam_id - 76561202109711576
    [Oxide] 12:28 AM [Info] username - Linux
    [Oxide] 12:28 AM [Error] Failed to call hook 'ccmdName' on plugin 'noname'
    File: test.lua Line: 40 attempt to concatenate field 'Value' (a userdata 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 (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
    perceived only char record?
     
  7. try to call tostring(col.Value)
     
  8. tnx, but null = -313396480 :)